GNUNET_CORE_disconnect (core_handle);
core_handle = NULL;
}
+ if (transport_handle != NULL)
+ {
+ GNUNET_TRANSPORT_disconnect (transport_handle);
+ transport_handle = NULL;
+ }
GNUNET_PEER_change_rc (myid, -1);
}
void
GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello)
{
- struct GNUNET_TIME_Absolute expiration;
- struct GNUNET_TIME_Relative remaining;
+ struct GNUNET_HELLO_Message *old;
size_t size;
- if (NULL == peer->hello)
+ old = GMP_get_hello (peer);
+ if (NULL == old)
{
size = GNUNET_HELLO_size (hello);
peer->hello = GNUNET_malloc (size);
memcpy (peer->hello, hello, size);
return;
}
-
- 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);
- size = GNUNET_HELLO_size (hello);
- peer->hello = GNUNET_malloc (size);
- memcpy (peer->hello, hello, size);
- }
else
{
- struct GNUNET_HELLO_Message *old;
-
- old = peer->hello;
peer->hello = GNUNET_HELLO_merge (old, hello);
GNUNET_free (old);
}
struct GNUNET_TIME_Absolute expiration;
struct GNUNET_TIME_Relative remaining;
+ if (NULL == peer->hello)
+ return NULL;
+
expiration = GNUNET_HELLO_get_last_expiration (peer->hello);
remaining = GNUNET_TIME_absolute_get_remaining (expiration);
if (0 == remaining.rel_value_us)