aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-02-04 12:36:33 +0000
committerBart Polot <bart@net.in.tum.de>2014-02-04 12:36:33 +0000
commit279064f3d08ce2ad15a9ef4be6e03351c3a0de6b (patch)
tree855a94a5f18e86859f11d332f1c9a3cdd4ec1268 /src/mesh
parent6217d452d5ff3f463c8c6668d6d8529be768ee15 (diff)
downloadgnunet-279064f3d08ce2ad15a9ef4be6e03351c3a0de6b.tar.gz
gnunet-279064f3d08ce2ad15a9ef4be6e03351c3a0de6b.zip
- merge hellos in case old hello is still valid
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/gnunet-service-mesh_peer.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c
index e073b3355..32d251396 100644
--- a/src/mesh/gnunet-service-mesh_peer.c
+++ b/src/mesh/gnunet-service-mesh_peer.c
@@ -1842,7 +1842,24 @@ GMP_get_tunnel (const struct MeshPeer *peer)
1842void 1842void
1843GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello) 1843GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello)
1844{ 1844{
1845 peer->hello = hello; 1845 struct GNUNET_TIME_Absolute expiration;
1846 struct GNUNET_TIME_Relative remaining;
1847
1848 if (NULL == peer->hello)
1849 {
1850 peer->hello = hello;
1851 return;
1852 }
1853
1854 expiration = GNUNET_HELLO_get_last_expiration (peer->hello);
1855 remaining = GNUNET_TIME_absolute_get_remaining (expiration);
1856 if (0 == remaining.rel_value_us)
1857 {
1858 GNUNET_free (peer->hello);
1859 peer->hello = hello;
1860 }
1861 else
1862 peer->hello = GNUNET_HELLO_merge (peer->hello, hello);
1846} 1863}
1847 1864
1848 1865