gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29917 - gnunet/src/conversation


From: gnunet
Subject: [GNUnet-SVN] r29917 - gnunet/src/conversation
Date: Mon, 7 Oct 2013 11:28:41 +0200

Author: grothoff
Date: 2013-10-07 11:28:41 +0200 (Mon, 07 Oct 2013)
New Revision: 29917

Modified:
   gnunet/src/conversation/conversation_api.c
Log:
-transmit termination reason also for caller hanging up

Modified: gnunet/src/conversation/conversation_api.c
===================================================================
--- gnunet/src/conversation/conversation_api.c  2013-10-07 08:48:43 UTC (rev 
29916)
+++ gnunet/src/conversation/conversation_api.c  2013-10-07 09:28:41 UTC (rev 
29917)
@@ -1071,6 +1071,21 @@
 
 
 /**
+ * We've sent the hang up message, now finish terminating the call.
+ *
+ * @param cls the `struct GNUNET_CONVERSATION_Call` to terminate
+ */
+static void
+finish_stop (void *cls)
+{
+  struct GNUNET_CONVERSATION_Call *call = cls;
+
+  GNUNET_assert (CS_SHUTDOWN == call->state);
+  GNUNET_CONVERSATION_call_stop (call, NULL);
+}
+
+
+/**
  * Terminate a call.  The call may be ringing or ready at this time.
  *
  * @param call call to terminate
@@ -1081,24 +1096,26 @@
 GNUNET_CONVERSATION_call_stop (struct GNUNET_CONVERSATION_Call *call,
                               const char *reason)
 {
+  struct GNUNET_MQ_Envelope *e;
+  struct ClientPhoneHangupMessage *hang;
+  size_t slen;
+
+  if ( (NULL != call->speaker) &&
+       (CS_ACTIVE == call->state) )
+    call->speaker->disable_speaker (call->speaker->cls);
+  if ( (NULL != call->mic) &&
+       (CS_ACTIVE == call->state) )
+    call->mic->disable_microphone (call->mic->cls);
   if (NULL != reason)
   {
-    // FIXME: transmit reason to service... (not implemented!)
-    GNUNET_break (0);
-    // return;
+    slen = strlen (reason) + 1;
+    e = GNUNET_MQ_msg_extra (hang, slen, 
GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP);
+    memcpy (&hang[1], reason, slen);
+    GNUNET_MQ_notify_sent (e, &finish_stop, call);
+    GNUNET_MQ_send (call->mq, e);
+    call->state = CS_SHUTDOWN;
+    return;
   }
-  if (NULL != call->speaker)
-  {
-    if (CS_ACTIVE == call->state)
-      call->speaker->disable_speaker (call->speaker->cls);
-    call->speaker = NULL;
-  }
-  if (NULL != call->mic)
-  {
-    if (CS_ACTIVE == call->state)
-      call->mic->disable_microphone (call->mic->cls);
-    call->mic =NULL;
-  }
   if (NULL != call->mq)
   {
     GNUNET_MQ_destroy (call->mq);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]