diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-07-15 11:45:11 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-07-15 11:45:11 +0000 |
commit | be292dcd4d2e4f15f319d00671ce6bd6410bee38 (patch) | |
tree | 0f6f4c778431f8d7e58bb9234a0a3269e062794b /src | |
parent | 966b264292fa54ea2fb1d43360708c98b6bc548d (diff) | |
download | gnunet-be292dcd4d2e4f15f319d00671ce6bd6410bee38.tar.gz gnunet-be292dcd4d2e4f15f319d00671ce6bd6410bee38.zip |
- don't send KEEPALIVE if the tunnel has traffic queued
Diffstat (limited to 'src')
-rw-r--r-- | src/cadet/gnunet-service-cadet_connection.c | 3 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.c | 21 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.h | 11 |
3 files changed, 34 insertions, 1 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 8cce9eae4..e0a2039cb 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c | |||
@@ -1064,8 +1064,9 @@ send_connection_keepalive (struct CadetConnection *c, int fwd) | |||
1064 | "keepalive %s for connection %s\n", | 1064 | "keepalive %s for connection %s\n", |
1065 | GC_f2s (fwd), GCC_2s (c)); | 1065 | GC_f2s (fwd), GCC_2s (c)); |
1066 | 1066 | ||
1067 | GNUNET_assert (NULL != c->t); | ||
1067 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 1068 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
1068 | if (0 < fc->queue_n) | 1069 | if (0 < fc->queue_n || GNUNET_YES == GCT_has_queued_traffic (c->t)) |
1069 | { | 1070 | { |
1070 | LOG (GNUNET_ERROR_TYPE_INFO, "not sending keepalive, traffic in queue\n"); | 1071 | LOG (GNUNET_ERROR_TYPE_INFO, "not sending keepalive, traffic in queue\n"); |
1071 | return; | 1072 | return; |
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c index 11016671e..226c9a846 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.c +++ b/src/cadet/gnunet-service-cadet_tunnel.c | |||
@@ -3705,7 +3705,13 @@ GCT_destroy (struct CadetTunnel *t) | |||
3705 | while (NULL != t->tq_head) | 3705 | while (NULL != t->tq_head) |
3706 | { | 3706 | { |
3707 | /* Should have been cleaned by destuction of channel. */ | 3707 | /* Should have been cleaned by destuction of channel. */ |
3708 | struct GNUNET_MessageHeader *mh; | ||
3709 | |||
3708 | GNUNET_break (0); | 3710 | GNUNET_break (0); |
3711 | mh = (struct GNUNET_MessageHeader *) &t->tq_head[1]; | ||
3712 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
3713 | "message left behind on tunnel shutdown: %s\n", | ||
3714 | GC_m2s (ntohs (mh->type))); | ||
3709 | unqueue_data (t->tq_head); | 3715 | unqueue_data (t->tq_head); |
3710 | } | 3716 | } |
3711 | 3717 | ||
@@ -4189,6 +4195,21 @@ GCT_cancel (struct CadetTunnelQueue *q) | |||
4189 | 4195 | ||
4190 | 4196 | ||
4191 | /** | 4197 | /** |
4198 | * Check if the tunnel has queued traffic. | ||
4199 | * | ||
4200 | * @param t Tunnel to check. | ||
4201 | * | ||
4202 | * @return #GNUNET_YES if there is queued traffic | ||
4203 | * #GNUNET_NO otherwise | ||
4204 | */ | ||
4205 | int | ||
4206 | GCT_has_queued_traffic (struct CadetTunnel *t) | ||
4207 | { | ||
4208 | return (NULL != t->tq_head) ? GNUNET_YES : GNUNET_NO; | ||
4209 | } | ||
4210 | |||
4211 | |||
4212 | /** | ||
4192 | * Sends an already built message on a tunnel, encrypting it and | 4213 | * Sends an already built message on a tunnel, encrypting it and |
4193 | * choosing the best connection if not provided. | 4214 | * choosing the best connection if not provided. |
4194 | * | 4215 | * |
diff --git a/src/cadet/gnunet-service-cadet_tunnel.h b/src/cadet/gnunet-service-cadet_tunnel.h index a2504436b..c7a795129 100644 --- a/src/cadet/gnunet-service-cadet_tunnel.h +++ b/src/cadet/gnunet-service-cadet_tunnel.h | |||
@@ -450,6 +450,17 @@ GCT_cancel (struct CadetTunnelQueue *q); | |||
450 | 450 | ||
451 | 451 | ||
452 | /** | 452 | /** |
453 | * Check if the tunnel has queued traffic. | ||
454 | * | ||
455 | * @param t Tunnel to check. | ||
456 | * | ||
457 | * @return #GNUNET_YES if there is queued traffic | ||
458 | * #GNUNET_NO otherwise | ||
459 | */ | ||
460 | int | ||
461 | GCT_has_queued_traffic (struct CadetTunnel *t); | ||
462 | |||
463 | /** | ||
453 | * Sends an already built message on a tunnel, encrypting it and | 464 | * Sends an already built message on a tunnel, encrypting it and |
454 | * choosing the best connection. | 465 | * choosing the best connection. |
455 | * | 466 | * |