-patch from #1972 to display disconnects instead of exiting
authorChristian Grothoff <christian@grothoff.org>
Tue, 7 Feb 2012 10:23:53 +0000 (10:23 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 7 Feb 2012 10:23:53 +0000 (10:23 +0000)
src/transport/gnunet-transport.c

index 4b0c08f548237658349609035343b8a744e7646b..5142ee6421a81e4965ec2c1bb6ee348ad0f535fa 100644 (file)
@@ -460,13 +460,11 @@ process_string (void *cls, const char *address)
 }
 
 /**
- * Function to call with a human-readable format of an address
+ * Function to call with a binary address
  *
  * @param cls closure
  * @param peer identity of the peer
- * @param transport name of the plugin
- * @param addr binary address
- * @param addrlen number of bytes in addr
+ * @param address binary address (NULL on disconnect)
  */
 static void
 process_address (void *cls, const struct GNUNET_PeerIdentity *peer,
@@ -474,12 +472,18 @@ process_address (void *cls, const struct GNUNET_PeerIdentity *peer,
 {
   const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
 
-  if ((address == NULL) || (peer == NULL))
+  if (peer == NULL)
   {
     /* done */
     return;
   }
 
+  if (address == NULL)
+  {
+    FPRINTF (stdout, _("Peer `%s' disconnected\n"), GNUNET_i2s (peer));
+    return;
+  }
+
   /* Resolve address to string */
   GNUNET_TRANSPORT_address_to_string (cfg, address, numeric,
                                       GNUNET_TIME_UNIT_MINUTES, &process_string,