aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-11-27 01:42:35 +0000
committerBart Polot <bart@net.in.tum.de>2013-11-27 01:42:35 +0000
commit5f2d097d94dfa3049f151eaeb69c6bb8ee0a75ff (patch)
tree1e8e75663ddb3f835f55b45640aab36c28cf2c4b
parent5fbb57dd6719f3672c8b63e2985002c6fa0f6ccd (diff)
downloadgnunet-5f2d097d94dfa3049f151eaeb69c6bb8ee0a75ff.tar.gz
gnunet-5f2d097d94dfa3049f151eaeb69c6bb8ee0a75ff.zip
- dont try to send data on connections that are going to be destroyed
-rw-r--r--src/mesh/gnunet-service-mesh_connection.c10
-rw-r--r--src/mesh/gnunet-service-mesh_connection.h5
2 files changed, 15 insertions, 0 deletions
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c
index 31ba440e6..cc5a19c74 100644
--- a/src/mesh/gnunet-service-mesh_connection.c
+++ b/src/mesh/gnunet-service-mesh_connection.c
@@ -334,6 +334,8 @@ GMC_state2s (enum MeshConnectionState s)
334 return "MESH_CONNECTION_ACK"; 334 return "MESH_CONNECTION_ACK";
335 case MESH_CONNECTION_READY: 335 case MESH_CONNECTION_READY:
336 return "MESH_CONNECTION_READY"; 336 return "MESH_CONNECTION_READY";
337 case MESH_CONNECTION_DESTROYED:
338 return "MESH_CONNECTION_DESTROYED";
337 default: 339 default:
338 return "MESH_CONNECTION_STATE_ERROR"; 340 return "MESH_CONNECTION_STATE_ERROR";
339 } 341 }
@@ -379,6 +381,11 @@ connection_change_state (struct MeshConnection* c,
379 LOG (GNUNET_ERROR_TYPE_DEBUG, 381 LOG (GNUNET_ERROR_TYPE_DEBUG,
380 "Connection %s state was %s\n", 382 "Connection %s state was %s\n",
381 GMC_2s (c), GMC_state2s (c->state)); 383 GMC_2s (c), GMC_state2s (c->state));
384 if (MESH_CONNECTION_DESTROYED == c->state)
385 {
386 LOG (GNUNET_ERROR_TYPE_DEBUG, "state not changing anymore\n");
387 return;
388 }
382 LOG (GNUNET_ERROR_TYPE_DEBUG, 389 LOG (GNUNET_ERROR_TYPE_DEBUG,
383 "Connection %s state is now %s\n", 390 "Connection %s state is now %s\n",
384 GMC_2s (c), GMC_state2s (state)); 391 GMC_2s (c), GMC_state2s (state));
@@ -1520,6 +1527,7 @@ GMC_handle_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
1520 } 1527 }
1521 GMC_send_prebuilt_message (message, c, fwd, NULL, NULL); 1528 GMC_send_prebuilt_message (message, c, fwd, NULL, NULL);
1522 c->destroy = GNUNET_YES; 1529 c->destroy = GNUNET_YES;
1530 c->state = MESH_CONNECTION_DESTROYED;
1523 1531
1524 return GNUNET_OK; 1532 return GNUNET_OK;
1525} 1533}
@@ -2399,6 +2407,7 @@ GMC_notify_broken (struct MeshConnection *c,
2399 * (the one we just scheduled), so no point in checking whether to 2407 * (the one we just scheduled), so no point in checking whether to
2400 * destroy immediately. */ 2408 * destroy immediately. */
2401 c->destroy = GNUNET_YES; 2409 c->destroy = GNUNET_YES;
2410 c->state = MESH_CONNECTION_DESTROYED;
2402 2411
2403 /** 2412 /**
2404 * Cancel all queues, if no message is left, connection will be destroyed. 2413 * Cancel all queues, if no message is left, connection will be destroyed.
@@ -2691,6 +2700,7 @@ GMC_send_destroy (struct MeshConnection *c)
2691 if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO)) 2700 if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO))
2692 GMC_send_prebuilt_message (&msg.header, c, GNUNET_NO, NULL, NULL); 2701 GMC_send_prebuilt_message (&msg.header, c, GNUNET_NO, NULL, NULL);
2693 c->destroy = GNUNET_YES; 2702 c->destroy = GNUNET_YES;
2703 c->state = MESH_CONNECTION_DESTROYED;
2694} 2704}
2695 2705
2696 2706
diff --git a/src/mesh/gnunet-service-mesh_connection.h b/src/mesh/gnunet-service-mesh_connection.h
index 00b5e082b..44d205756 100644
--- a/src/mesh/gnunet-service-mesh_connection.h
+++ b/src/mesh/gnunet-service-mesh_connection.h
@@ -64,6 +64,11 @@ enum MeshConnectionState
64 * Connection confirmed, ready to carry traffic. 64 * Connection confirmed, ready to carry traffic.
65 */ 65 */
66 MESH_CONNECTION_READY, 66 MESH_CONNECTION_READY,
67
68 /**
69 * Connection to be destroyed, just waiting to empty queues.
70 */
71 MESH_CONNECTION_DESTROYED,
67}; 72};
68 73
69 74