aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-07-28 05:12:40 +0000
committerBart Polot <bart@net.in.tum.de>2014-07-28 05:12:40 +0000
commit85d611c006759e6b30dc032dd5b681562b0549b0 (patch)
treea14f30e30d2f796a01ce410866432b7a62487080 /src/cadet
parent1721895119c3309f2ac2c255e0470bdf7fe0ba04 (diff)
downloadgnunet-85d611c006759e6b30dc032dd5b681562b0549b0.tar.gz
gnunet-85d611c006759e6b30dc032dd5b681562b0549b0.zip
Resend traffic queued on connections that time-out, if the peer is an endpoint.
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index 6412a2752..64a82371a 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -1282,6 +1282,34 @@ connection_fwd_timeout (void *cls,
1282 return; 1282 return;
1283 } 1283 }
1284 1284
1285 if (GCC_is_origin (c, GNUNET_NO)) /* If dest, salvage queued traffic. */
1286 {
1287 struct GNUNET_MessageHeader *out_msg;
1288 struct CadetPeer *neighbor;
1289 struct CadetTunnel *t;
1290 int destroyed;
1291
1292 t = c->t;
1293 destroyed = GNUNET_NO;
1294 neighbor = get_hop (c, GNUNET_NO);
1295
1296 /* GCP_connection_pop could destroy the connection! */
1297 while (NULL != (out_msg = GCP_connection_pop (neighbor, c, &destroyed)))
1298 {
1299 GCT_resend_message (out_msg, t);
1300 }
1301 /* All pending messages should have been popped,
1302 * and the connection destroyed by the continuation.
1303 */
1304 if (GNUNET_YES != destroyed)
1305 {
1306 GNUNET_break (0);
1307 GCC_debug (c, GNUNET_ERROR_TYPE_ERROR);
1308 GCC_destroy (c);
1309 }
1310 return;
1311 }
1312
1285 GCC_destroy (c); 1313 GCC_destroy (c);
1286} 1314}
1287 1315
@@ -1290,6 +1318,8 @@ connection_fwd_timeout (void *cls,
1290 * Timeout function due to lack of keepalive/traffic from the destination. 1318 * Timeout function due to lack of keepalive/traffic from the destination.
1291 * Destroys connection if called. 1319 * Destroys connection if called.
1292 * 1320 *
1321 * FIXME refactor and merge with connection_fwd_timeout.
1322 *
1293 * @param cls Closure (connection to destroy). 1323 * @param cls Closure (connection to destroy).
1294 * @param tc TaskContext 1324 * @param tc TaskContext
1295 */ 1325 */
@@ -1312,6 +1342,34 @@ connection_bck_timeout (void *cls,
1312 return; 1342 return;
1313 } 1343 }
1314 1344
1345 if (GCC_is_origin (c, GNUNET_YES)) /* If dest, salvage queued traffic. */
1346 {
1347 struct GNUNET_MessageHeader *out_msg;
1348 struct CadetPeer *neighbor;
1349 struct CadetTunnel *t;
1350 int destroyed;
1351
1352 t = c->t;
1353 destroyed = GNUNET_NO;
1354 neighbor = get_hop (c, GNUNET_YES);
1355
1356 /* GCP_connection_pop could destroy the connection! */
1357 while (NULL != (out_msg = GCP_connection_pop (neighbor, c, &destroyed)))
1358 {
1359 GCT_resend_message (out_msg, t);
1360 }
1361 /* All pending messages should have been popped,
1362 * and the connection destroyed by the continuation.
1363 */
1364 if (GNUNET_YES != destroyed)
1365 {
1366 GNUNET_break (0);
1367 GCC_debug (c, GNUNET_ERROR_TYPE_ERROR);
1368 GCC_destroy (c);
1369 }
1370 return;
1371 }
1372
1315 GCC_destroy (c); 1373 GCC_destroy (c);
1316} 1374}
1317 1375