aboutsummaryrefslogtreecommitdiff
path: root/src/conversation
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-07 09:28:41 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-07 09:28:41 +0000
commita129eafa4c349d30f6a1323f854bf31d69bb776f (patch)
treece116a4f59113183eaf4acc69ad0961445788fe6 /src/conversation
parent3853037fa5690e42397cb6e171f8bfc010f405a5 (diff)
downloadgnunet-a129eafa4c349d30f6a1323f854bf31d69bb776f.tar.gz
gnunet-a129eafa4c349d30f6a1323f854bf31d69bb776f.zip
-transmit termination reason also for caller hanging up
Diffstat (limited to 'src/conversation')
-rw-r--r--src/conversation/conversation_api.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index 6e1cbe3fb..50ee0a23a 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -1071,6 +1071,21 @@ GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
1071 1071
1072 1072
1073/** 1073/**
1074 * We've sent the hang up message, now finish terminating the call.
1075 *
1076 * @param cls the `struct GNUNET_CONVERSATION_Call` to terminate
1077 */
1078static void
1079finish_stop (void *cls)
1080{
1081 struct GNUNET_CONVERSATION_Call *call = cls;
1082
1083 GNUNET_assert (CS_SHUTDOWN == call->state);
1084 GNUNET_CONVERSATION_call_stop (call, NULL);
1085}
1086
1087
1088/**
1074 * Terminate a call. The call may be ringing or ready at this time. 1089 * Terminate a call. The call may be ringing or ready at this time.
1075 * 1090 *
1076 * @param call call to terminate 1091 * @param call call to terminate
@@ -1081,23 +1096,25 @@ void
1081GNUNET_CONVERSATION_call_stop (struct GNUNET_CONVERSATION_Call *call, 1096GNUNET_CONVERSATION_call_stop (struct GNUNET_CONVERSATION_Call *call,
1082 const char *reason) 1097 const char *reason)
1083{ 1098{
1099 struct GNUNET_MQ_Envelope *e;
1100 struct ClientPhoneHangupMessage *hang;
1101 size_t slen;
1102
1103 if ( (NULL != call->speaker) &&
1104 (CS_ACTIVE == call->state) )
1105 call->speaker->disable_speaker (call->speaker->cls);
1106 if ( (NULL != call->mic) &&
1107 (CS_ACTIVE == call->state) )
1108 call->mic->disable_microphone (call->mic->cls);
1084 if (NULL != reason) 1109 if (NULL != reason)
1085 { 1110 {
1086 // FIXME: transmit reason to service... (not implemented!) 1111 slen = strlen (reason) + 1;
1087 GNUNET_break (0); 1112 e = GNUNET_MQ_msg_extra (hang, slen, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP);
1088 // return; 1113 memcpy (&hang[1], reason, slen);
1089 } 1114 GNUNET_MQ_notify_sent (e, &finish_stop, call);
1090 if (NULL != call->speaker) 1115 GNUNET_MQ_send (call->mq, e);
1091 { 1116 call->state = CS_SHUTDOWN;
1092 if (CS_ACTIVE == call->state) 1117 return;
1093 call->speaker->disable_speaker (call->speaker->cls);
1094 call->speaker = NULL;
1095 }
1096 if (NULL != call->mic)
1097 {
1098 if (CS_ACTIVE == call->state)
1099 call->mic->disable_microphone (call->mic->cls);
1100 call->mic =NULL;
1101 } 1118 }
1102 if (NULL != call->mq) 1119 if (NULL != call->mq)
1103 { 1120 {