diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-12-12 18:00:06 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-12-12 18:00:06 +0000 |
commit | 223657699f2e2f5b5bfa91a3a08784952e604c2e (patch) | |
tree | 2ce2d5fa8c6d56fa02638df3aa9ca8477e9544fe | |
parent | c1027cfb9548432c94a6d091be310631a9eb6740 (diff) | |
download | gnunet-223657699f2e2f5b5bfa91a3a08784952e604c2e.tar.gz gnunet-223657699f2e2f5b5bfa91a3a08784952e604c2e.zip |
- react to connection destrutcion in exisitng tunnel
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 2 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 25 |
2 files changed, 25 insertions, 2 deletions
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 9806bf674..06bd15231 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -2564,7 +2564,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2564 | memcpy (data, message, size); | 2564 | memcpy (data, message, size); |
2565 | type = ntohs (message->type); | 2565 | type = ntohs (message->type); |
2566 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u bytes) on connection %s\n", | 2566 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Send %s (%u bytes) on connection %s\n", |
2567 | GM_m2s (type), size, GMC_2s (c)); | 2567 | GM_m2s (type), size, GMC_2s (c)); |
2568 | 2568 | ||
2569 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 2569 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
2570 | droppable = GNUNET_NO == force; | 2570 | droppable = GNUNET_NO == force; |
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 1fb37bcd3..83c024de1 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -768,7 +768,7 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
768 | tq->tqd = NULL; | 768 | tq->tqd = NULL; |
769 | } | 769 | } |
770 | tq->cq = GMC_send_prebuilt_message (&msg->header, c, fwd, force, | 770 | tq->cq = GMC_send_prebuilt_message (&msg->header, c, fwd, force, |
771 | &message_sent, tq); | 771 | &message_sent, tq); |
772 | tq->cont = cont; | 772 | tq->cont = cont; |
773 | tq->cont_cls = cont_cls; | 773 | tq->cont_cls = cont_cls; |
774 | 774 | ||
@@ -1748,7 +1748,10 @@ void | |||
1748 | GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c) | 1748 | GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c) |
1749 | { | 1749 | { |
1750 | struct MeshTConnection *aux; | 1750 | struct MeshTConnection *aux; |
1751 | unsigned int i; | ||
1751 | 1752 | ||
1753 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing connection %s from tunnel %s\n", | ||
1754 | GMC_2s (c), GMT_2s (t)); | ||
1752 | for (aux = t->connection_head; aux != NULL; aux = aux->next) | 1755 | for (aux = t->connection_head; aux != NULL; aux = aux->next) |
1753 | if (aux->c == c) | 1756 | if (aux->c == c) |
1754 | { | 1757 | { |
@@ -1756,6 +1759,26 @@ GMT_remove_connection (struct MeshTunnel3 *t, struct MeshConnection *c) | |||
1756 | GNUNET_free (aux); | 1759 | GNUNET_free (aux); |
1757 | return; | 1760 | return; |
1758 | } | 1761 | } |
1762 | |||
1763 | /* Start new connections if needed */ | ||
1764 | if (NULL == t->connection_head) | ||
1765 | { | ||
1766 | LOG (GNUNET_ERROR_TYPE_DEBUG, " no more connections\n"); | ||
1767 | GMP_connect (t->peer); | ||
1768 | t->cstate = MESH_TUNNEL3_SEARCHING; | ||
1769 | return; | ||
1770 | } | ||
1771 | |||
1772 | /* If not marked as ready, no change is needed */ | ||
1773 | if (MESH_TUNNEL3_READY != t->cstate) | ||
1774 | return; | ||
1775 | |||
1776 | /* Check if any connection is ready to maintaing cstate */ | ||
1777 | for (aux = t->connection_head; aux != NULL; aux = aux->next) | ||
1778 | if (MESH_CONNECTION_READY == GMC_get_state (aux->c)) | ||
1779 | return; | ||
1780 | |||
1781 | t->cstate = MESH_TUNNEL3_WAITING; | ||
1759 | } | 1782 | } |
1760 | 1783 | ||
1761 | 1784 | ||