- dont return expired hellos
authorBart Polot <bart@net.in.tum.de>
Tue, 4 Feb 2014 12:36:35 +0000 (12:36 +0000)
committerBart Polot <bart@net.in.tum.de>
Tue, 4 Feb 2014 12:36:35 +0000 (12:36 +0000)
src/mesh/gnunet-service-mesh_peer.c

index 32d2513968e05248ea195793fa3c852ca7eda8c7..244839f445a99a21b3397e5ccad4db58e857f749 100644 (file)
@@ -1873,6 +1873,16 @@ GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello)
 const struct GNUNET_HELLO_Message *
 GMP_get_hello (struct MeshPeer *peer)
 {
+  struct GNUNET_TIME_Absolute expiration;
+  struct GNUNET_TIME_Relative remaining;
+
+  expiration = GNUNET_HELLO_get_last_expiration (peer->hello);
+  remaining = GNUNET_TIME_absolute_get_remaining (expiration);
+  if (0 == remaining.rel_value_us)
+  {
+    GNUNET_free (peer->hello);
+    peer->hello = NULL;
+  }
   return peer->hello;
 }