gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r27187 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r27187 - gnunet/src/mesh
Date: Thu, 16 May 2013 20:01:26 +0200

Author: bartpolot
Date: 2013-05-16 20:01:25 +0200 (Thu, 16 May 2013)
New Revision: 27187

Modified:
   gnunet/src/mesh/gnunet-service-mesh-new.c
Log:
- start listening to clients only after CORE connection

Modified: gnunet/src/mesh/gnunet-service-mesh-new.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh-new.c   2013-05-16 18:00:57 UTC (rev 
27186)
+++ gnunet/src/mesh/gnunet-service-mesh-new.c   2013-05-16 18:01:25 UTC (rev 
27187)
@@ -4611,6 +4611,24 @@
 
 
 /**
+ * Install server (service) handlers and start listening to clients.
+ */
+static void
+server_init (void)
+{
+  GNUNET_SERVER_add_handlers (server_handle, client_handlers);
+  GNUNET_SERVER_disconnect_notify (server_handle,
+                                   &handle_local_client_disconnect, NULL);
+  nc = GNUNET_SERVER_notification_context_create (server_handle, 1);
+
+  clients_head = NULL;
+  clients_tail = NULL;
+  next_client_id = 0;
+  GNUNET_SERVER_resume (server_handle);
+}
+
+
+/**
  * To be called on core init/fail.
  *
  * @param cls Closure (config)
@@ -4625,7 +4643,7 @@
   static int i = 0;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core init\n");
-  core_handle = server;
+  GNUNET_break (core_handle == server);
   if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id)) ||
     NULL == server)
   {
@@ -4650,7 +4668,8 @@
     if (10 < i++)
       GNUNET_abort();
   }
-    return;
+  server_init ();
+  return;
 }
 
 
@@ -4765,7 +4784,7 @@
   struct MeshPeerInfo *peer;
   struct MeshPeerPath *p;
 
-  keygen = NULL;  
+  keygen = NULL;
   if (NULL == pk)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -4803,17 +4822,6 @@
   next_tid = 0;
   next_local_tid = GNUNET_MESH_LOCAL_TUNNEL_ID_SERV;
 
-
-  GNUNET_SERVER_add_handlers (server_handle, client_handlers);
-  nc = GNUNET_SERVER_notification_context_create (server_handle, 1);
-  GNUNET_SERVER_disconnect_notify (server_handle,
-                                   &handle_local_client_disconnect, NULL);
-
-
-  clients_head = NULL;
-  clients_tail = NULL;
-  next_client_id = 0;
-
   announce_id_task = GNUNET_SCHEDULER_add_now (&announce_id, cls);
 
   /* Create a peer_info for the local peer */
@@ -4822,7 +4830,7 @@
   p->peers[0] = myid;
   GNUNET_PEER_change_rc (myid, 1);
   peer_info_add_path (peer, p, GNUNET_YES);
-  GNUNET_SERVER_resume (server_handle);
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mesh service running\n");
 }
 
@@ -4842,6 +4850,7 @@
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n");
   server_handle = server;
+  GNUNET_SERVER_suspend (server_handle);
 
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_filename (c, "PEER", "PRIVATE_KEY",
@@ -4959,7 +4968,6 @@
   }
   stats = GNUNET_STATISTICS_create ("mesh", c);
 
-  GNUNET_SERVER_suspend (server_handle);
   /* Scheduled the task to clean up when shutdown is called */
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
                                 NULL);




reply via email to

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