- connect_notify is also called with NULL on server shutdown
authorBart Polot <bart@net.in.tum.de>
Sat, 13 Jul 2013 01:32:57 +0000 (01:32 +0000)
committerBart Polot <bart@net.in.tum.de>
Sat, 13 Jul 2013 01:32:57 +0000 (01:32 +0000)
src/include/gnunet_server_lib.h
src/mesh/gnunet-service-mesh.c
src/util/server.c

index c8138cd550d165ac7196522c2c3a2f68a5655e99..2c64b4698c248b55a6d111d65a7c18d3b6045361 100644 (file)
@@ -476,7 +476,11 @@ GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server,
 /**
  * Ask the server to notify us whenever a client connects.
  * This function is called whenever the actual network connection
- * is opened.
+ * is opened. If the server is destroyed before this
+ * notification is explicitly cancelled, the 'callback' will
+ * once be called with a 'client' argument of NULL to indicate
+ * that the server itself is now gone (and that the callback
+ * won't be called anymore and also can no longer be cancelled).
  *
  * @param server the server manageing the clients
  * @param callback function to call on sconnect
index 169d3ce6308fd82fd32807a3586fe69e5b9cebe0..d07703a7f0d8ccc0eff37831213955f24d20facf 100644 (file)
@@ -4405,6 +4405,8 @@ handle_local_client_connect (void *cls, struct GNUNET_SERVER_Client *client)
 {
   struct MeshClient *c;
 
+  if (NULL == client)
+    return;
   c = GNUNET_malloc (sizeof (struct MeshClient));
   c->handle = client;
   GNUNET_SERVER_client_keep (client);
index 6dbb5dc236e20cced4f727f989105dc7ea0a5d3d..46410e90efd203caf816a292462091ed869d4e8a 100644 (file)
@@ -1342,7 +1342,11 @@ GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server,
 /**
  * Ask the server to notify us whenever a client connects.
  * This function is called whenever the actual network connection
- * is opened.
+ * is opened. If the server is destroyed before this
+ * notification is explicitly cancelled, the 'callback' will
+ * once be called with a 'client' argument of NULL to indicate
+ * that the server itself is now gone (and that the callback
+ * won't be called anymore and also can no longer be cancelled).
  *
  * @param server the server manageing the clients
  * @param callback function to call on sconnect