gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34903 - in gnunet/src: conversation include scalarproduct


From: gnunet
Subject: [GNUnet-SVN] r34903 - in gnunet/src: conversation include scalarproduct util
Date: Fri, 16 Jan 2015 12:47:42 +0100

Author: grothoff
Date: 2015-01-16 12:47:42 +0100 (Fri, 16 Jan 2015)
New Revision: 34903

Modified:
   gnunet/src/conversation/conversation_api_call.c
   gnunet/src/conversation/gnunet-conversation.c
   gnunet/src/include/gnunet_conversation_service.h
   gnunet/src/scalarproduct/perf_scalarproduct.sh
   gnunet/src/util/client.c
Log:
fix #3611

Modified: gnunet/src/conversation/conversation_api_call.c
===================================================================
--- gnunet/src/conversation/conversation_api_call.c     2015-01-16 11:39:16 UTC 
(rev 34902)
+++ gnunet/src/conversation/conversation_api_call.c     2015-01-16 11:47:42 UTC 
(rev 34903)
@@ -485,27 +485,6 @@
 static void
 reconnect_call (struct GNUNET_CONVERSATION_Call *call)
 {
-  static struct GNUNET_MQ_MessageHandler handlers[] =
-  {
-    { &handle_call_suspend,
-      GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND,
-      sizeof (struct ClientPhoneSuspendMessage) },
-    { &handle_call_resume,
-      GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME,
-      sizeof (struct ClientPhoneResumeMessage) },
-    { &handle_call_picked_up,
-      GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP,
-      sizeof (struct ClientPhonePickedupMessage) },
-    { &handle_call_hangup,
-      GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
-      sizeof (struct ClientPhoneHangupMessage) },
-    { &handle_call_audio_message,
-      GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
-      0 },
-    { NULL, 0, 0 }
-  };
-  struct GNUNET_CRYPTO_EcdsaPublicKey my_zone;
-
   if (CS_ACTIVE == call->state)
   {
     call->speaker->disable_speaker (call->speaker->cls);
@@ -522,29 +501,9 @@
     call->client = NULL;
   }
   call->state = CS_SHUTDOWN;
-  call->client = GNUNET_CLIENT_connect ("conversation", call->cfg);
-  if (NULL == call->client)
-  {
-    call->event_handler (call->event_handler_cls,
+  call->event_handler (call->event_handler_cls,
                        GNUNET_CONVERSATION_EC_CALL_ERROR);
-    return;
-  }
-
-  call->mq = GNUNET_MQ_queue_for_connection_client (call->client,
-                                                    handlers,
-                                                    &call_error_handler,
-                                                    call);
-  call->state = CS_LOOKUP;
-  GNUNET_IDENTITY_ego_get_public_key (call->zone_id,
-                                      &my_zone);
-  call->gns_lookup = GNUNET_GNS_lookup (call->gns,
-                                        call->callee,
-                                        &my_zone,
-                                        GNUNET_GNSRECORD_TYPE_PHONE,
-                                        GNUNET_NO,
-                                        NULL /* FIXME: add shortening support 
*/,
-                                        &handle_gns_response, call);
-  GNUNET_assert (NULL != call->gns_lookup);
+  GNUNET_CONVERSATION_call_stop (call);
 }
 
 
@@ -562,6 +521,7 @@
  *        #GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated)
  * @param event_handler how to notify the owner of the phone about events
  * @param event_handler_cls closure for @a event_handler
+ * @return handle for the call, NULL on hard errors
  */
 struct GNUNET_CONVERSATION_Call *
 GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -573,9 +533,36 @@
                                GNUNET_CONVERSATION_CallEventHandler 
event_handler,
                                void *event_handler_cls)
 {
+  static struct GNUNET_MQ_MessageHandler handlers[] =
+  {
+    { &handle_call_suspend,
+      GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND,
+      sizeof (struct ClientPhoneSuspendMessage) },
+    { &handle_call_resume,
+      GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME,
+      sizeof (struct ClientPhoneResumeMessage) },
+    { &handle_call_picked_up,
+      GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP,
+      sizeof (struct ClientPhonePickedupMessage) },
+    { &handle_call_hangup,
+      GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
+      sizeof (struct ClientPhoneHangupMessage) },
+    { &handle_call_audio_message,
+      GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
+      0 },
+    { NULL, 0, 0 }
+  };
+  struct GNUNET_CRYPTO_EcdsaPublicKey my_zone;
   struct GNUNET_CONVERSATION_Call *call;
 
   call = GNUNET_new (struct GNUNET_CONVERSATION_Call);
+  call->client = GNUNET_CLIENT_connect ("conversation", cfg);
+  if (NULL == call->client)
+  {
+    GNUNET_break (0);
+    GNUNET_free (call);
+    return NULL;
+  }
   call->cfg = cfg;
   call->caller_id = caller_id;
   call->zone_id = zone_id;
@@ -585,14 +572,26 @@
   call->event_handler = event_handler;
   call->event_handler_cls = event_handler_cls;
   call->gns = GNUNET_GNS_connect (cfg);
-  reconnect_call (call);
-
-  if ( (NULL == call->client) ||
-       (NULL == call->gns) )
+  if (NULL == call->gns)
   {
     GNUNET_CONVERSATION_call_stop (call);
     return NULL;
   }
+  call->mq = GNUNET_MQ_queue_for_connection_client (call->client,
+                                                    handlers,
+                                                    &call_error_handler,
+                                                    call);
+  call->state = CS_LOOKUP;
+  GNUNET_IDENTITY_ego_get_public_key (call->zone_id,
+                                      &my_zone);
+  call->gns_lookup = GNUNET_GNS_lookup (call->gns,
+                                        call->callee,
+                                        &my_zone,
+                                        GNUNET_GNSRECORD_TYPE_PHONE,
+                                        GNUNET_NO,
+                                        NULL /* FIXME: add shortening support 
*/,
+                                        &handle_gns_response, call);
+  GNUNET_assert (NULL != call->gns_lookup);
   return call;
 }
 

Modified: gnunet/src/conversation/gnunet-conversation.c
===================================================================
--- gnunet/src/conversation/gnunet-conversation.c       2015-01-16 11:39:16 UTC 
(rev 34902)
+++ gnunet/src/conversation/gnunet-conversation.c       2015-01-16 11:47:42 UTC 
(rev 34903)
@@ -440,8 +440,9 @@
   case GNUNET_CONVERSATION_EC_CALL_ERROR:
     FPRINTF (stdout,
              _("Error with the call, restarting it\n"));
-    call_state = CS_RESOLVING;
-    // FIXME: is this correct?
+    GNUNET_free (peer_name);
+    peer_name = NULL;
+    call = NULL;
     break;
   }
 }

Modified: gnunet/src/include/gnunet_conversation_service.h
===================================================================
--- gnunet/src/include/gnunet_conversation_service.h    2015-01-16 11:39:16 UTC 
(rev 34902)
+++ gnunet/src/include/gnunet_conversation_service.h    2015-01-16 11:47:42 UTC 
(rev 34903)
@@ -295,6 +295,7 @@
  */
 enum GNUNET_CONVERSATION_CallEventCode
 {
+
   /**
    * We are the caller and are now ringing the other party (GNS lookup
    * succeeded).

Modified: gnunet/src/scalarproduct/perf_scalarproduct.sh
===================================================================
--- gnunet/src/scalarproduct/perf_scalarproduct.sh      2015-01-16 11:39:16 UTC 
(rev 34902)
+++ gnunet/src/scalarproduct/perf_scalarproduct.sh      2015-01-16 11:47:42 UTC 
(rev 34903)
@@ -10,7 +10,7 @@
 # 400                149           23
 # 800                304           32
 # Configure benchmark size:
-SIZE=25
+SIZE=1600
 #
 # Construct input vectors:
 INPUTALICE="-k CCC -e '"

Modified: gnunet/src/util/client.c
===================================================================
--- gnunet/src/util/client.c    2015-01-16 11:39:16 UTC (rev 34902)
+++ gnunet/src/util/client.c    2015-01-16 11:47:42 UTC (rev 34903)
@@ -1208,7 +1208,7 @@
   {
     /* If this breaks, you most likley called this function twice without 
waiting
      * for completion or canceling the request */
-    GNUNET_break (0);
+    GNUNET_assert (0);
     return NULL;
   }
   th = GNUNET_new (struct GNUNET_CLIENT_TransmitHandle);




reply via email to

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