diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-04-09 10:56:51 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-04-09 10:56:51 +0000 |
commit | 6006a7fff8fb87fcb6aee2bed652853f94696801 (patch) | |
tree | d2739c2311f57a99777da25e65847199b22d28de /src | |
parent | d630a144eb35de83151b72c0ace6c11d10174fc2 (diff) | |
download | gnunet-6006a7fff8fb87fcb6aee2bed652853f94696801.tar.gz gnunet-6006a7fff8fb87fcb6aee2bed652853f94696801.zip |
- send buffered data to client before destroying channel
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh_channel.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c index 3548ac6df..3af326912 100644 --- a/src/mesh/gnunet-service-mesh_channel.c +++ b/src/mesh/gnunet-service-mesh_channel.c | |||
@@ -600,7 +600,6 @@ send_client_buffered_data (struct MeshChannel *ch, | |||
600 | " reliable && don't have %u, next is %u\n", | 600 | " reliable && don't have %u, next is %u\n", |
601 | rel->mid_recv, | 601 | rel->mid_recv, |
602 | copy->mid); | 602 | copy->mid); |
603 | return; | ||
604 | } | 603 | } |
605 | } | 604 | } |
606 | LOG (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data END\n"); | 605 | LOG (GNUNET_ERROR_TYPE_DEBUG, "send_buffered_data END\n"); |
@@ -1125,7 +1124,6 @@ rel_message_free (struct MeshReliableMessage *copy, int update_time) | |||
1125 | 1124 | ||
1126 | if (GNUNET_NO != rel->ch->destroy && 0 == rel->ch->pending_messages) | 1125 | if (GNUNET_NO != rel->ch->destroy && 0 == rel->ch->pending_messages) |
1127 | { | 1126 | { |
1128 | struct MeshTunnel3 *t = rel->ch->t; | ||
1129 | GMCH_destroy (rel->ch); | 1127 | GMCH_destroy (rel->ch); |
1130 | return GNUNET_YES; | 1128 | return GNUNET_YES; |
1131 | } | 1129 | } |
@@ -1671,7 +1669,16 @@ GMCH_handle_local_ack (struct MeshChannel *ch, int fwd) | |||
1671 | 1669 | ||
1672 | rel->client_ready = GNUNET_YES; | 1670 | rel->client_ready = GNUNET_YES; |
1673 | send_client_buffered_data (ch, c, fwd); | 1671 | send_client_buffered_data (ch, c, fwd); |
1674 | if (is_loopback (ch)) | 1672 | |
1673 | if (GNUNET_YES == ch->destroy && 0 == rel->n_recv) | ||
1674 | { | ||
1675 | send_destroy (ch, GNUNET_YES); | ||
1676 | GMCH_destroy (ch); | ||
1677 | } | ||
1678 | /* if loopback is marked for destruction, no need to ACK to the other peer, | ||
1679 | * it requested the destruction and is already gone, therefore, else if. | ||
1680 | */ | ||
1681 | else if (is_loopback (ch)) | ||
1675 | { | 1682 | { |
1676 | unsigned int buffer; | 1683 | unsigned int buffer; |
1677 | 1684 | ||
@@ -1774,8 +1781,6 @@ GMCH_handle_local_destroy (struct MeshChannel *ch, | |||
1774 | struct MeshClient *c, | 1781 | struct MeshClient *c, |
1775 | int is_root) | 1782 | int is_root) |
1776 | { | 1783 | { |
1777 | struct MeshTunnel3 *t; | ||
1778 | |||
1779 | ch->destroy = GNUNET_YES; | 1784 | ch->destroy = GNUNET_YES; |
1780 | /* Cleanup after the tunnel */ | 1785 | /* Cleanup after the tunnel */ |
1781 | if (GNUNET_NO == is_root && c == ch->dest) | 1786 | if (GNUNET_NO == is_root && c == ch->dest) |
@@ -1791,7 +1796,6 @@ GMCH_handle_local_destroy (struct MeshChannel *ch, | |||
1791 | ch->root = NULL; | 1796 | ch->root = NULL; |
1792 | } | 1797 | } |
1793 | 1798 | ||
1794 | t = ch->t; | ||
1795 | send_destroy (ch, GNUNET_NO); | 1799 | send_destroy (ch, GNUNET_NO); |
1796 | if (0 == ch->pending_messages) | 1800 | if (0 == ch->pending_messages) |
1797 | GMCH_destroy (ch); | 1801 | GMCH_destroy (ch); |
@@ -2221,6 +2225,8 @@ GMCH_handle_destroy (struct MeshChannel *ch, | |||
2221 | const struct GNUNET_MESH_ChannelManage *msg, | 2225 | const struct GNUNET_MESH_ChannelManage *msg, |
2222 | int fwd) | 2226 | int fwd) |
2223 | { | 2227 | { |
2228 | struct MeshChannelReliability *rel; | ||
2229 | |||
2224 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ | 2230 | /* If this is a remote (non-loopback) channel, find 'fwd'. */ |
2225 | if (GNUNET_SYSERR == fwd) | 2231 | if (GNUNET_SYSERR == fwd) |
2226 | { | 2232 | { |
@@ -2240,9 +2246,16 @@ GMCH_handle_destroy (struct MeshChannel *ch, | |||
2240 | return; | 2246 | return; |
2241 | } | 2247 | } |
2242 | 2248 | ||
2243 | 2249 | rel = fwd ? ch->dest_rel : ch->root_rel; | |
2244 | send_destroy (ch, GNUNET_YES); | 2250 | if (0 == rel->n_recv) |
2245 | GMCH_destroy (ch); | 2251 | { |
2252 | send_destroy (ch, GNUNET_YES); | ||
2253 | GMCH_destroy (ch); | ||
2254 | } | ||
2255 | else | ||
2256 | { | ||
2257 | ch->destroy = GNUNET_YES; | ||
2258 | } | ||
2246 | } | 2259 | } |
2247 | 2260 | ||
2248 | 2261 | ||