int priority;
int call_core;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
+ LOG (GNUNET_ERROR_TYPE_INFO,
"queue add %s %s towards %s (size %u) on c %p (%s)\n",
GM_f2s (fwd), GM_m2s (type), GMP_2s(peer),
size, c, GMC_2s (c));
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);
}
* @param hello Hello message.
*/
void
-GMP_set_hello (struct MeshPeer *peer, struct GNUNET_HELLO_Message *hello)
+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)
{
- peer->hello = hello;
+ 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)
+ else
{
- GNUNET_free (peer->hello);
- peer->hello = hello;
+ peer->hello = GNUNET_HELLO_merge (old, hello);
+ GNUNET_free (old);
}
- else
- peer->hello = GNUNET_HELLO_merge (peer->hello, hello);
}
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)