diff options
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 9 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_peer.c | 1 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 13 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index a31bfd5e2..b4df7cb48 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -75,6 +75,12 @@ GNUNET_PEER_Id myid; | |||
75 | */ | 75 | */ |
76 | struct GNUNET_PeerIdentity my_full_id; | 76 | struct GNUNET_PeerIdentity my_full_id; |
77 | 77 | ||
78 | |||
79 | /** | ||
80 | * Signal that shutdown is happening: prevent recover measures. | ||
81 | */ | ||
82 | int shutting_down; | ||
83 | |||
78 | /*************************** Static global variables **************************/ | 84 | /*************************** Static global variables **************************/ |
79 | 85 | ||
80 | /** | 86 | /** |
@@ -98,6 +104,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
98 | { | 104 | { |
99 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutting down\n"); | 105 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutting down\n"); |
100 | 106 | ||
107 | shutting_down = GNUNET_YES; | ||
108 | |||
101 | GML_shutdown (); | 109 | GML_shutdown (); |
102 | GMD_shutdown (); | 110 | GMD_shutdown (); |
103 | GMC_shutdown (); | 111 | GMC_shutdown (); |
@@ -160,6 +168,7 @@ main (int argc, char *const *argv) | |||
160 | int ret; | 168 | int ret; |
161 | int r; | 169 | int r; |
162 | 170 | ||
171 | shutting_down = GNUNET_NO; | ||
163 | r = GNUNET_SERVICE_run (argc, argv, "mesh", GNUNET_SERVICE_OPTION_NONE, &run, | 172 | r = GNUNET_SERVICE_run (argc, argv, "mesh", GNUNET_SERVICE_OPTION_NONE, &run, |
164 | NULL); | 173 | NULL); |
165 | GNUNET_free (my_private_key); | 174 | GNUNET_free (my_private_key); |
diff --git a/src/mesh/gnunet-service-mesh_peer.c b/src/mesh/gnunet-service-mesh_peer.c index 6c5bbf752..30c64377f 100644 --- a/src/mesh/gnunet-service-mesh_peer.c +++ b/src/mesh/gnunet-service-mesh_peer.c | |||
@@ -1695,6 +1695,7 @@ GMP_get_short_id (const struct MeshPeer *peer) | |||
1695 | struct MeshTunnel3 * | 1695 | struct MeshTunnel3 * |
1696 | GMP_get_tunnel (const struct MeshPeer *peer) | 1696 | GMP_get_tunnel (const struct MeshPeer *peer) |
1697 | { | 1697 | { |
1698 | GNUNET_assert (NULL != peer->tunnel); | ||
1698 | return peer->tunnel; | 1699 | return peer->tunnel; |
1699 | } | 1700 | } |
1700 | 1701 | ||
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index f192bb05b..181395b09 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -222,6 +222,12 @@ extern struct GNUNET_PeerIdentity my_full_id; | |||
222 | 222 | ||
223 | 223 | ||
224 | /** | 224 | /** |
225 | * Don't try to recover tunnels if shutting down. | ||
226 | */ | ||
227 | extern int shutting_down; | ||
228 | |||
229 | |||
230 | /** | ||
225 | * Set of all tunnels, in order to trigger a new exchange on rekey. | 231 | * Set of all tunnels, in order to trigger a new exchange on rekey. |
226 | * Indexed by peer's ID. | 232 | * Indexed by peer's ID. |
227 | */ | 233 | */ |
@@ -1756,7 +1762,8 @@ GMT_add_connection (struct MeshTunnel3 *t, struct MeshConnection *c) | |||
1756 | * @param c Connection. | 1762 | * @param c Connection. |
1757 | */ | 1763 | */ |
1758 | void | 1764 | void |
1759 | GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c) | 1765 | GMT_remove_connection (struct MeshTunnel3 *t, |
1766 | struct MeshConnection *c) | ||
1760 | { | 1767 | { |
1761 | struct MeshTConnection *aux; | 1768 | struct MeshTConnection *aux; |
1762 | struct MeshTConnection *next; | 1769 | struct MeshTConnection *next; |
@@ -1774,7 +1781,9 @@ GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c) | |||
1774 | } | 1781 | } |
1775 | 1782 | ||
1776 | /* Start new connections if needed */ | 1783 | /* Start new connections if needed */ |
1777 | if (NULL == t->connection_head && GNUNET_NO == t->destroy) | 1784 | if (NULL == t->connection_head |
1785 | && GNUNET_NO == t->destroy | ||
1786 | && GNUNET_NO == shutting_down) | ||
1778 | { | 1787 | { |
1779 | LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections\n"); | 1788 | LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections\n"); |
1780 | GMP_connect (t->peer); | 1789 | GMP_connect (t->peer); |