- cancel SYNACK retry task when forced to SYNACK by an incoming SYN
[oweals/gnunet.git] / src / mesh / gnunet-service-mesh_hello.c
index fa1429fd977e64663bf7bffca339b7186811e074..723989bf8b473bd55e576c7e8b926eba4b1bb7d2 100644 (file)
@@ -100,14 +100,27 @@ got_hello (void *cls, const struct GNUNET_PeerIdentity *id,
 {
   struct MeshPeer *peer;
 
-  if (NULL == id)
+  if (NULL == id || NULL == hello)
   {
-    LOG (GNUNET_ERROR_TYPE_ERROR, " hello with NULL id\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG, " hello with id %p and msg %p\n", id, hello);
+    return;
+  }
+  LOG (GNUNET_ERROR_TYPE_DEBUG, " hello for %s (%d bytes), expires on %s\n",
+       GNUNET_i2s (id), NULL != hello ? GNUNET_HELLO_size (hello) : -1,
+       GNUNET_STRINGS_absolute_time_to_string (GNUNET_HELLO_get_last_expiration(hello)));
+  if (NULL == hello)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, " hello is NULL\n");
     return;
   }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, " hello for %s\n", GNUNET_i2s (id));
   peer = GMP_get (id);
   GMP_set_hello (peer, hello);
+
+  if (GMP_get_short_id (peer) == myid)
+  {
+    mine = GMP_get_hello (peer);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, " updated mine to %p\n", mine);
+  }
 }
 
 
@@ -124,7 +137,7 @@ void
 GMH_init (const struct GNUNET_CONFIGURATION_Handle *c)
 {
   LOG (GNUNET_ERROR_TYPE_DEBUG, "init\n");
-  GNUNET_assert (NULL != nc);
+  GNUNET_assert (NULL == nc);
   peerinfo = GNUNET_PEERINFO_connect (c);
   nc = GNUNET_PEERINFO_notify (c, GNUNET_NO, &got_hello, NULL);
 }
@@ -157,6 +170,7 @@ GMH_shutdown ()
 const struct GNUNET_HELLO_Message *
 GMH_get_mine (void)
 {
+  LOG (GNUNET_ERROR_TYPE_DEBUG, " mine is %p\n", mine);
   return mine;
 }