diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-12-09 13:55:59 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-12-09 13:55:59 +0000 |
commit | 14ea7e035554bc6a1685e57355ef0dcb532ba9c6 (patch) | |
tree | d0ad8930ac3bf224ec675c215d1798425d959bf6 | |
parent | d00711efe0479e56f21c6e959bcaeae3e43bfeff (diff) | |
download | gnunet-14ea7e035554bc6a1685e57355ef0dcb532ba9c6.tar.gz gnunet-14ea7e035554bc6a1685e57355ef0dcb532ba9c6.zip |
- don't flag as ERROR if channel is loopback (no retransmissions necessary in that case)
-rw-r--r-- | src/mesh/gnunet-service-mesh_channel.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c index 08f2fca48..ee8597773 100644 --- a/src/mesh/gnunet-service-mesh_channel.c +++ b/src/mesh/gnunet-service-mesh_channel.c | |||
@@ -339,6 +339,23 @@ send_ack (struct MeshChannel *ch, int fwd); | |||
339 | 339 | ||
340 | 340 | ||
341 | /** | 341 | /** |
342 | * Test if the channel is loopback: both root and dest are on the local peer. | ||
343 | * | ||
344 | * @param ch Channel to test. | ||
345 | * | ||
346 | * @return #GNUNET_YES if channel is loopback, #GNUNET_NO otherwise. | ||
347 | */ | ||
348 | static int | ||
349 | is_loopback (const struct MeshChannel *ch) | ||
350 | { | ||
351 | if (NULL != ch->t) | ||
352 | return GMT_is_loopback (ch->t); | ||
353 | |||
354 | return (NULL != ch->root && NULL != ch->dest); | ||
355 | } | ||
356 | |||
357 | |||
358 | /** | ||
342 | * We have received a message out of order, or the client is not ready. | 359 | * We have received a message out of order, or the client is not ready. |
343 | * Buffer it until we receive an ACK from the client or the missing | 360 | * Buffer it until we receive an ACK from the client or the missing |
344 | * message from the channel. | 361 | * message from the channel. |
@@ -386,6 +403,7 @@ add_buffered_data (const struct GNUNET_MESH_Data *msg, | |||
386 | LOG (GNUNET_ERROR_TYPE_DEBUG, "add_buffered_data END\n"); | 403 | LOG (GNUNET_ERROR_TYPE_DEBUG, "add_buffered_data END\n"); |
387 | } | 404 | } |
388 | 405 | ||
406 | |||
389 | /** | 407 | /** |
390 | * Add a destination client to a channel, initializing all data structures | 408 | * Add a destination client to a channel, initializing all data structures |
391 | * in the channel and the client. | 409 | * in the channel and the client. |
@@ -1104,8 +1122,11 @@ channel_confirm (struct MeshChannel *ch, int fwd) | |||
1104 | } | 1122 | } |
1105 | else | 1123 | else |
1106 | { | 1124 | { |
1107 | /* We SHOULD have been trying to retransmit this! */ | 1125 | if (GNUNET_NO == is_loopback (ch)) |
1108 | GNUNET_break (oldstate == MESH_CHANNEL_READY); | 1126 | { |
1127 | /* We SHOULD have been trying to retransmit this! */ | ||
1128 | GNUNET_break (oldstate == MESH_CHANNEL_READY); | ||
1129 | } | ||
1109 | } | 1130 | } |
1110 | 1131 | ||
1111 | /* In case of a FWD ACK (SYNACK) send a BCK ACK (ACK). */ | 1132 | /* In case of a FWD ACK (SYNACK) send a BCK ACK (ACK). */ |
@@ -1188,23 +1209,6 @@ channel_new (struct MeshTunnel3 *t, | |||
1188 | 1209 | ||
1189 | 1210 | ||
1190 | /** | 1211 | /** |
1191 | * Test if the channel is loopback: both root and dest are on the local peer. | ||
1192 | * | ||
1193 | * @param ch Channel to test. | ||
1194 | * | ||
1195 | * @return #GNUNET_YES if channel is loopback, #GNUNET_NO otherwise. | ||
1196 | */ | ||
1197 | static int | ||
1198 | is_loopback (const struct MeshChannel *ch) | ||
1199 | { | ||
1200 | if (NULL != ch->t) | ||
1201 | return GMT_is_loopback (ch->t); | ||
1202 | |||
1203 | return (NULL != ch->root && NULL != ch->dest); | ||
1204 | } | ||
1205 | |||
1206 | |||
1207 | /** | ||
1208 | * Handle a loopback message: call the appropriate handler for the message type. | 1212 | * Handle a loopback message: call the appropriate handler for the message type. |
1209 | * | 1213 | * |
1210 | * @param ch Channel this message is on. | 1214 | * @param ch Channel this message is on. |