aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-10-06 17:38:50 +0000
committerBart Polot <bart@net.in.tum.de>2011-10-06 17:38:50 +0000
commit7639188c0a248382968c1f1015687eb7b37b59b8 (patch)
tree483f3cafcb9e33866e1201b10b4eca38b56d84f9 /src/mesh/gnunet-service-mesh.c
parent3647df0bbd6bd27866ee63e5b9020776e9a7ce01 (diff)
downloadgnunet-7639188c0a248382968c1f1015687eb7b37b59b8.tar.gz
gnunet-7639188c0a248382968c1f1015687eb7b37b59b8.zip
Stop all DHT get requests before disconnecting
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index f30661abe..ba0244881 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -1187,6 +1187,9 @@ tunnel_destroy (struct MeshTunnel *t)
1187 /* TODO cancel core transmit ready in case it was active */ 1187 /* TODO cancel core transmit ready in case it was active */
1188 } 1188 }
1189 tree_destroy(t->tree); 1189 tree_destroy(t->tree);
1190 if (NULL != t->dht_get_type)
1191 GNUNET_DHT_get_stop(t->dht_get_type);
1192 t->dht_get_type = NULL;
1190 GNUNET_free (t); 1193 GNUNET_free (t);
1191 return r; 1194 return r;
1192} 1195}
@@ -3240,6 +3243,24 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
3240/******************************************************************************/ 3243/******************************************************************************/
3241 3244
3242/** 3245/**
3246 * Iterator over hash map entries.
3247 *
3248 * @param cls closure
3249 * @param key current key code
3250 * @param value value in the hash map
3251 * @return GNUNET_YES if we should continue to
3252 * iterate,
3253 * GNUNET_NO if not.
3254 */
3255int
3256shutdown_tunnel (void *cls, const GNUNET_HashCode * key, void *value)
3257{
3258 struct MeshTunnel *t = value;
3259 tunnel_destroy(t);
3260 return GNUNET_YES;
3261}
3262
3263/**
3243 * Task run during shutdown. 3264 * Task run during shutdown.
3244 * 3265 *
3245 * @param cls unused 3266 * @param cls unused
@@ -3255,6 +3276,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3255 GNUNET_CORE_disconnect (core_handle); 3276 GNUNET_CORE_disconnect (core_handle);
3256 core_handle = NULL; 3277 core_handle = NULL;
3257 } 3278 }
3279 GNUNET_CONTAINER_multihashmap_iterate(tunnels, &shutdown_tunnel, NULL);
3258 if (dht_handle != NULL) 3280 if (dht_handle != NULL)
3259 { 3281 {
3260 GNUNET_DHT_disconnect (dht_handle); 3282 GNUNET_DHT_disconnect (dht_handle);