diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-26 18:07:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-26 18:07:37 +0000 |
commit | be98885538291da444b6558f9168e59ac5183440 (patch) | |
tree | 0a4bcec76684dc269e2b42b233b89f748e067c1c /src/transport/transport_api.c | |
parent | 439ed1a79cc8b11a546656f406c0819a65330ae5 (diff) | |
download | gnunet-be98885538291da444b6558f9168e59ac5183440.tar.gz gnunet-be98885538291da444b6558f9168e59ac5183440.zip |
-fix udp transmission, avoid scheduling when unready
Diffstat (limited to 'src/transport/transport_api.c')
-rw-r--r-- | src/transport/transport_api.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 55caf407a..f69cd80cc 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -780,7 +780,7 @@ demultiplexer (void *cls, | |||
780 | if (bytes_physical >= bytes_msg) | 780 | if (bytes_physical >= bytes_msg) |
781 | { | 781 | { |
782 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 782 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
783 | "Overhead for %u byte message: %u\n", | 783 | "Overhead for %u byte message was %u\n", |
784 | bytes_msg, | 784 | bytes_msg, |
785 | bytes_physical - bytes_msg); | 785 | bytes_physical - bytes_msg); |
786 | n->traffic_overhead += bytes_physical - bytes_msg; | 786 | n->traffic_overhead += bytes_physical - bytes_msg; |
@@ -799,9 +799,11 @@ demultiplexer (void *cls, | |||
799 | n->th->timeout_task = NULL; | 799 | n->th->timeout_task = NULL; |
800 | /* we've been waiting for this (congestion, not quota, | 800 | /* we've been waiting for this (congestion, not quota, |
801 | * caused delayed transmission) */ | 801 | * caused delayed transmission) */ |
802 | n->hn = GNUNET_CONTAINER_heap_insert (h->ready_heap, n, 0); | 802 | n->hn = GNUNET_CONTAINER_heap_insert (h->ready_heap, |
803 | schedule_transmission (h); | 803 | n, |
804 | 0); | ||
804 | } | 805 | } |
806 | schedule_transmission (h); | ||
805 | break; | 807 | break; |
806 | case GNUNET_MESSAGE_TYPE_TRANSPORT_RECV: | 808 | case GNUNET_MESSAGE_TYPE_TRANSPORT_RECV: |
807 | if (size < | 809 | if (size < |
@@ -822,8 +824,10 @@ demultiplexer (void *cls, | |||
822 | break; | 824 | break; |
823 | } | 825 | } |
824 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 826 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
825 | "Received message of type %u from `%s'.\n", | 827 | "Received message of type %u with %u bytes from `%s'.\n", |
826 | ntohs (imm->type), GNUNET_i2s (&im->peer)); | 828 | (unsigned int) ntohs (imm->type), |
829 | (unsigned int) ntohs (imm->size), | ||
830 | GNUNET_i2s (&im->peer)); | ||
827 | n = neighbour_find (h, &im->peer); | 831 | n = neighbour_find (h, &im->peer); |
828 | if (NULL == n) | 832 | if (NULL == n) |
829 | { | 833 | { |
@@ -1102,6 +1106,8 @@ schedule_transmission_task (void *cls, | |||
1102 | } | 1106 | } |
1103 | else | 1107 | else |
1104 | { | 1108 | { |
1109 | if (GNUNET_YES != n->is_ready) | ||
1110 | return; /* service not ready for another one */ | ||
1105 | n = GNUNET_CONTAINER_heap_peek (h->ready_heap); | 1111 | n = GNUNET_CONTAINER_heap_peek (h->ready_heap); |
1106 | if (NULL == n) | 1112 | if (NULL == n) |
1107 | return; /* no pending messages */ | 1113 | return; /* no pending messages */ |
@@ -1148,7 +1154,11 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h) | |||
1148 | n->traffic_overhead = 0; | 1154 | n->traffic_overhead = 0; |
1149 | } | 1155 | } |
1150 | else | 1156 | else |
1157 | { | ||
1158 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1159 | "No work to be done, not scheduling transmission.\n"); | ||
1151 | return; /* no work to be done */ | 1160 | return; /* no work to be done */ |
1161 | } | ||
1152 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1162 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1153 | "Scheduling next transmission to service in %s\n", | 1163 | "Scheduling next transmission to service in %s\n", |
1154 | GNUNET_STRINGS_relative_time_to_string (delay, | 1164 | GNUNET_STRINGS_relative_time_to_string (delay, |
@@ -1364,8 +1374,7 @@ send_try_connect (void *cls, | |||
1364 | if (NULL == buf) | 1374 | if (NULL == buf) |
1365 | { | 1375 | { |
1366 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1376 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1367 | "Discarding `%s' request to `%s' due to error in transport service connection.\n", | 1377 | "Discarding REQUEST_CONNECT request to `%s' due to error in transport service connection.\n", |
1368 | "REQUEST_CONNECT", | ||
1369 | GNUNET_i2s (&tch->pid)); | 1378 | GNUNET_i2s (&tch->pid)); |
1370 | if (NULL != tch->cb) | 1379 | if (NULL != tch->cb) |
1371 | tch->cb (tch->cb_cls, | 1380 | tch->cb (tch->cb_cls, |