aboutsummaryrefslogtreecommitdiff
path: root/src/conversation
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-16 17:13:37 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-16 17:13:37 +0000
commit92f8aed964cff174491adbf308974ab09874926b (patch)
tree537115d586203b856a3ef3ab351a8b783c06c907 /src/conversation
parenta4d350f7de02167577ba8c760f08a0866bc2c9e7 (diff)
downloadgnunet-92f8aed964cff174491adbf308974ab09874926b.tar.gz
gnunet-92f8aed964cff174491adbf308974ab09874926b.zip
-doxygen, minor bug fixes
Diffstat (limited to 'src/conversation')
-rw-r--r--src/conversation/conversation_api.c9
-rw-r--r--src/conversation/conversation_api_call.c2
-rw-r--r--src/conversation/gnunet-conversation.c46
-rw-r--r--src/conversation/gnunet-service-conversation.c3
4 files changed, 53 insertions, 7 deletions
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index aad272d9c..c8289fe01 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -355,11 +355,20 @@ handle_phone_hangup (void *cls,
355 if (hang->cid == caller->cid) 355 if (hang->cid == caller->cid)
356 break; 356 break;
357 if (NULL == caller) 357 if (NULL == caller)
358 {
359 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
360 "Received HANG_UP message for unknown caller ID %u\n",
361 (unsigned int) hang->cid);
358 return; 362 return;
363 }
359 364
365 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
366 "Received HANG_UP message, terminating call with `%s'\n",
367 caller->caller_id_str);
360 switch (caller->state) 368 switch (caller->state)
361 { 369 {
362 case CS_RESOLVE: 370 case CS_RESOLVE:
371 /* application doesn't even know about call yet */
363 GNUNET_NAMESTORE_cancel (caller->qe); 372 GNUNET_NAMESTORE_cancel (caller->qe);
364 caller->qe = NULL; 373 caller->qe = NULL;
365 break; 374 break;
diff --git a/src/conversation/conversation_api_call.c b/src/conversation/conversation_api_call.c
index 25e60f0f3..4a671cbda 100644
--- a/src/conversation/conversation_api_call.c
+++ b/src/conversation/conversation_api_call.c
@@ -610,10 +610,10 @@ GNUNET_CONVERSATION_call_stop (struct GNUNET_CONVERSATION_Call *call)
610 call->mic->disable_microphone (call->mic->cls); 610 call->mic->disable_microphone (call->mic->cls);
611 if (CS_SHUTDOWN != call->state) 611 if (CS_SHUTDOWN != call->state)
612 { 612 {
613 call->state = CS_SHUTDOWN;
613 e = GNUNET_MQ_msg (hang, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP); 614 e = GNUNET_MQ_msg (hang, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP);
614 GNUNET_MQ_notify_sent (e, &finish_stop, call); 615 GNUNET_MQ_notify_sent (e, &finish_stop, call);
615 GNUNET_MQ_send (call->mq, e); 616 GNUNET_MQ_send (call->mq, e);
616 call->state = CS_SHUTDOWN;
617 return; 617 return;
618 } 618 }
619 if (NULL != call->mq) 619 if (NULL != call->mq)
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c
index 5961046d1..45ecdac91 100644
--- a/src/conversation/gnunet-conversation.c
+++ b/src/conversation/gnunet-conversation.c
@@ -840,6 +840,9 @@ do_resume (const char *args)
840static void 840static void
841do_reject (const char *args) 841do_reject (const char *args)
842{ 842{
843 struct CallList *cl;
844 char buf[32];
845
843 if (NULL != call) 846 if (NULL != call)
844 { 847 {
845 GNUNET_CONVERSATION_call_stop (call); 848 GNUNET_CONVERSATION_call_stop (call);
@@ -849,20 +852,53 @@ do_reject (const char *args)
849 switch (phone_state) 852 switch (phone_state)
850 { 853 {
851 case PS_LOOKUP_EGO: 854 case PS_LOOKUP_EGO:
852 case PS_LISTEN:
853 case PS_ERROR: 855 case PS_ERROR:
854 FPRINTF (stderr, 856 FPRINTF (stderr,
855 "%s", 857 "%s",
856 _("There is no call that could be cancelled right now.\n")); 858 _("There is no call that could be cancelled right now.\n"));
857 return; 859 return;
860 case PS_LISTEN:
861 /* look for active incoming calls to refuse */
862 cl = cl_head;
863 if (NULL == cl)
864 {
865 FPRINTF (stderr,
866 _("There is no incoming call to refuse here!\n"));
867 return;
868 }
869 if ( (NULL != cl->next) || (NULL != args) )
870 {
871 for (cl = cl_head; NULL != cl; cl = cl->next)
872 {
873 GNUNET_snprintf (buf, sizeof (buf),
874 "%u",
875 cl->caller_num);
876 if (0 == strcmp (buf, args))
877 break;
878 }
879 }
880 if (NULL == cl)
881 {
882 FPRINTF (stderr,
883 _("There is no incoming call `%s' to refuse right now!\n"),
884 args);
885 return;
886 }
887 GNUNET_CONVERSATION_caller_hang_up (cl->caller);
888 GNUNET_CONTAINER_DLL_remove (cl_head,
889 cl_tail,
890 cl);
891 GNUNET_free (cl->caller_id);
892 GNUNET_free (cl);
893 break;
858 case PS_ACCEPTED: 894 case PS_ACCEPTED:
859 /* expected state, do rejection logic */ 895 /* expected state, do rejection logic */
896 GNUNET_assert (NULL != cl_active);
897 GNUNET_CONVERSATION_caller_hang_up (cl_active->caller);
898 cl_active = NULL;
899 phone_state = PS_LISTEN;
860 break; 900 break;
861 } 901 }
862 GNUNET_assert (NULL != cl_active);
863 GNUNET_CONVERSATION_caller_hang_up (cl_active->caller);
864 cl_active = NULL;
865 phone_state = PS_LISTEN;
866} 902}
867 903
868 904
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c
index 67ac31918..36e8d5060 100644
--- a/src/conversation/gnunet-service-conversation.c
+++ b/src/conversation/gnunet-service-conversation.c
@@ -1337,7 +1337,8 @@ inbound_end (void *cls,
1337 ch->channel_reliable = NULL; 1337 ch->channel_reliable = NULL;
1338 1338
1339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1340 "Mesh channel destroyed by mesh\n"); 1340 "Mesh channel destroyed by mesh in state %d\n",
1341 ch->status);
1341 hup.header.size = sizeof (hup); 1342 hup.header.size = sizeof (hup);
1342 hup.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP); 1343 hup.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP);
1343 hup.cid = ch->cid; 1344 hup.cid = ch->cid;