aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-service-conversation.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-12-16 15:13:51 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-12-16 15:13:51 +0000
commit5344248f0bbb85e427b1a32ac78b53aa41084d1d (patch)
treef1d341cf7163e0a103612d3a65843e588eb4b22c /src/conversation/gnunet-service-conversation.c
parentcaa41792e389361146533317cf97fc9e376128c7 (diff)
downloadgnunet-5344248f0bbb85e427b1a32ac78b53aa41084d1d.tar.gz
gnunet-5344248f0bbb85e427b1a32ac78b53aa41084d1d.zip
- debug
- htonl source line number while calling - do not select a suspended channel upon receiving the first audio message
Diffstat (limited to 'src/conversation/gnunet-service-conversation.c')
-rw-r--r--src/conversation/gnunet-service-conversation.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index 597f341c7..5d1aaf6e1 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -713,7 +713,7 @@ handle_client_call_message (void *cls,
713 GNUNET_CRYPTO_ecdsa_key_get_public (&msg->caller_id, 713 GNUNET_CRYPTO_ecdsa_key_get_public (&msg->caller_id,
714 &ring->caller_id); 714 &ring->caller_id);
715 ring->remote_line = msg->line; 715 ring->remote_line = msg->line;
716 ring->source_line = line->local_line; 716 ring->source_line = htonl (line->local_line);
717 ring->target = msg->target; 717 ring->target = msg->target;
718 ring->source = my_identity; 718 ring->source = my_identity;
719 ring->expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (RING_TIMEOUT)); 719 ring->expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (RING_TIMEOUT));
@@ -757,8 +757,8 @@ transmit_line_audio (void *cls,
757 GNUNET_free (ch->audio_data); 757 GNUNET_free (ch->audio_data);
758 ch->audio_data = NULL; 758 ch->audio_data = NULL;
759 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 759 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
760 "Sending %u bytes of audio data on line %u via mesh\n", 760 "Sending %u bytes of audio data from line %u to remote line %u via mesh\n",
761 ch->audio_size, ch->remote_line); 761 ch->audio_size, ch->line->local_line, ch->remote_line);
762 return sizeof (struct MeshAudioMessage) + ch->audio_size; 762 return sizeof (struct MeshAudioMessage) + ch->audio_size;
763} 763}
764 764
@@ -819,6 +819,12 @@ handle_client_audio_message (void *cls,
819 GNUNET_SERVER_receive_done (client, GNUNET_OK); 819 GNUNET_SERVER_receive_done (client, GNUNET_OK);
820 return; 820 return;
821 } 821 }
822 if (GNUNET_YES == ch->suspended_local)
823 {
824 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "This channel is suspended locally\n");
825 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
826 return;
827 }
822 if (NULL == ch->channel_unreliable) 828 if (NULL == ch->channel_unreliable)
823 { 829 {
824 GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, 830 GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK,
@@ -942,7 +948,8 @@ handle_mesh_ring_message (void *cls,
942 cring.cid = ch->cid; 948 cring.cid = ch->cid;
943 cring.caller_id = msg->caller_id; 949 cring.caller_id = msg->caller_id;
944 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 950 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
945 "Sending RING message to client\n"); 951 "Sending RING message to client. CID %u:(%u, %u)\n",
952 ch->cid, ch->remote_line, line->local_line);
946 GNUNET_SERVER_notification_context_unicast (nc, 953 GNUNET_SERVER_notification_context_unicast (nc,
947 line->client, 954 line->client,
948 &cring.header, 955 &cring.header,
@@ -1113,6 +1120,9 @@ handle_mesh_suspend_message (void *cls,
1113 suspend.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND); 1120 suspend.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND);
1114 suspend.cid = ch->cid; 1121 suspend.cid = ch->cid;
1115 GNUNET_MESH_receive_done (channel); 1122 GNUNET_MESH_receive_done (channel);
1123 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1124 "Suspending channel CID: %u(%u:%u)\n",
1125 ch->cid, ch->remote_line, line->local_line);
1116 switch (ch->status) 1126 switch (ch->status)
1117 { 1127 {
1118 case CS_CALLEE_RINGING: 1128 case CS_CALLEE_RINGING:
@@ -1252,20 +1262,36 @@ handle_mesh_audio_message (void *cls,
1252 (NULL == ch->channel_unreliable) ) 1262 (NULL == ch->channel_unreliable) )
1253 break; 1263 break;
1254 } 1264 }
1265 break;
1255 } 1266 }
1267 if (NULL == line)
1268 {
1269 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1270 "Received %u bytes of AUDIO data for non-existing line %u, dropping.\n",
1271 msize, ntohl (msg->remote_line));
1272 return GNUNET_SYSERR;
1273 }
1256 if (NULL == ch) 1274 if (NULL == ch)
1257 { 1275 {
1258 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1276 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1259 "Received AUDIO data for non-existing line %u, dropping.\n", 1277 "Received %u bytes of AUDIO data for unknown sender.\n",
1260 ntohl (msg->remote_line)); 1278 msize);
1261 return GNUNET_SYSERR; 1279 return GNUNET_SYSERR;
1262 } 1280 }
1281 if ((GNUNET_YES == ch->suspended_local) || (GNUNET_YES == ch->suspended_remote))
1282 {
1283 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1284 "Received %u bytes of AUDIO data on suspended channel CID %u:(%u:%u); dropping\n",
1285 msize, ch->cid, ch->remote_line, line->local_line);
1286 return GNUNET_OK;
1287 }
1263 ch->channel_unreliable = channel; 1288 ch->channel_unreliable = channel;
1264 *channel_ctx = ch; 1289 *channel_ctx = ch;
1265 } 1290 }
1291 GNUNET_break (ch->line->local_line == ntohl (msg->remote_line));
1266 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1292 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1267 "Forwarding %u bytes of AUDIO data to client\n", 1293 "Forwarding %u bytes of AUDIO data to client CID %u:(%u:%u)\n",
1268 msize); 1294 msize, ch->cid, ch->remote_line, ch->line->local_line);
1269 cam = (struct ClientAudioMessage *) buf; 1295 cam = (struct ClientAudioMessage *) buf;
1270 cam->header.size = htons (sizeof (buf)); 1296 cam->header.size = htons (sizeof (buf));
1271 cam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO); 1297 cam->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO);