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 | |
parent | 439ed1a79cc8b11a546656f406c0819a65330ae5 (diff) | |
download | gnunet-be98885538291da444b6558f9168e59ac5183440.tar.gz gnunet-be98885538291da444b6558f9168e59ac5183440.zip |
-fix udp transmission, avoid scheduling when unready
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 20 | ||||
-rw-r--r-- | src/transport/test_transport_api_reliability.c | 23 | ||||
-rw-r--r-- | src/transport/transport_api.c | 23 |
3 files changed, 48 insertions, 18 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index d1ea23645..5faed3ad0 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1825,6 +1825,10 @@ qc_fragment_sent (void *cls, | |||
1825 | GNUNET_assert (NULL != udpw->frag_ctx); | 1825 | GNUNET_assert (NULL != udpw->frag_ctx); |
1826 | if (GNUNET_OK == result) | 1826 | if (GNUNET_OK == result) |
1827 | { | 1827 | { |
1828 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1829 | "Fragment of message with %u bytes transmitted to %s\n", | ||
1830 | (unsigned int) udpw->payload_size, | ||
1831 | GNUNET_i2s (&udpw->session->target)); | ||
1828 | GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag); | 1832 | GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag); |
1829 | GNUNET_STATISTICS_update (plugin->env->stats, | 1833 | GNUNET_STATISTICS_update (plugin->env->stats, |
1830 | "# UDP, fragmented msgs, fragments, sent, success", | 1834 | "# UDP, fragmented msgs, fragments, sent, success", |
@@ -1837,6 +1841,10 @@ qc_fragment_sent (void *cls, | |||
1837 | } | 1841 | } |
1838 | else | 1842 | else |
1839 | { | 1843 | { |
1844 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1845 | "Failed to transmit fragment of message with %u bytes to %s\n", | ||
1846 | (unsigned int) udpw->payload_size, | ||
1847 | GNUNET_i2s (&udpw->session->target)); | ||
1840 | fragmented_message_done (udpw->frag_ctx, | 1848 | fragmented_message_done (udpw->frag_ctx, |
1841 | GNUNET_SYSERR); | 1849 | GNUNET_SYSERR); |
1842 | GNUNET_STATISTICS_update (plugin->env->stats, | 1850 | GNUNET_STATISTICS_update (plugin->env->stats, |
@@ -1892,6 +1900,10 @@ enqueue_fragment (void *cls, | |||
1892 | msg_len); | 1900 | msg_len); |
1893 | enqueue (plugin, | 1901 | enqueue (plugin, |
1894 | udpw); | 1902 | udpw); |
1903 | if (session->address->address_length == sizeof (struct IPv4UdpAddress)) | ||
1904 | schedule_select_v4 (plugin); | ||
1905 | else | ||
1906 | schedule_select_v6 (plugin); | ||
1895 | } | 1907 | } |
1896 | 1908 | ||
1897 | 1909 | ||
@@ -2102,6 +2114,10 @@ udp_plugin_send (void *cls, | |||
2102 | "# UDP, unfragmented bytes payload queued total", | 2114 | "# UDP, unfragmented bytes payload queued total", |
2103 | msgbuf_size, | 2115 | msgbuf_size, |
2104 | GNUNET_NO); | 2116 | GNUNET_NO); |
2117 | if (s->address->address_length == sizeof (struct IPv4UdpAddress)) | ||
2118 | schedule_select_v4 (plugin); | ||
2119 | else | ||
2120 | schedule_select_v6 (plugin); | ||
2105 | } | 2121 | } |
2106 | else | 2122 | else |
2107 | { | 2123 | { |
@@ -2167,10 +2183,6 @@ udp_plugin_send (void *cls, | |||
2167 | notify_session_monitor (s->plugin, | 2183 | notify_session_monitor (s->plugin, |
2168 | s, | 2184 | s, |
2169 | GNUNET_TRANSPORT_SS_UPDATE); | 2185 | GNUNET_TRANSPORT_SS_UPDATE); |
2170 | if (s->address->address_length == sizeof (struct IPv4UdpAddress)) | ||
2171 | schedule_select_v4 (plugin); | ||
2172 | else | ||
2173 | schedule_select_v6 (plugin); | ||
2174 | return udpmlen; | 2186 | return udpmlen; |
2175 | } | 2187 | } |
2176 | 2188 | ||
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index c95729ab9..0b80477bf 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -393,8 +393,10 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
393 | #if VERBOSE | 393 | #if VERBOSE |
394 | if (ntohl (hdr->num) % 5 == 0) | 394 | if (ntohl (hdr->num) % 5 == 0) |
395 | { | 395 | { |
396 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got message %u of size %u\n", | 396 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
397 | ntohl (hdr->num), ntohs (message->size)); | 397 | "Got message %u of size %u\n", |
398 | ntohl (hdr->num), | ||
399 | ntohs (message->size)); | ||
398 | } | 400 | } |
399 | #endif | 401 | #endif |
400 | n++; | 402 | n++; |
@@ -505,7 +507,8 @@ notify_ready (void *cls, size_t size, void *buf) | |||
505 | static void | 507 | static void |
506 | notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | 508 | notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) |
507 | { | 509 | { |
508 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' connected to us (%p)!\n", | 510 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
511 | "Peer `%4s' connected to us (%p)!\n", | ||
509 | GNUNET_i2s (peer), cls); | 512 | GNUNET_i2s (peer), cls); |
510 | } | 513 | } |
511 | 514 | ||
@@ -513,7 +516,8 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
513 | static void | 516 | static void |
514 | notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | 517 | notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) |
515 | { | 518 | { |
516 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' disconnected (%p)!\n", | 519 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
520 | "Peer `%4s' disconnected (%p)!\n", | ||
517 | GNUNET_i2s (peer), cls); | 521 | GNUNET_i2s (peer), cls); |
518 | if (th != NULL) | 522 | if (th != NULL) |
519 | GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); | 523 | GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); |
@@ -522,7 +526,8 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
522 | 526 | ||
523 | 527 | ||
524 | static void | 528 | static void |
525 | sendtask () | 529 | sendtask (void *cls, |
530 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
526 | { | 531 | { |
527 | start_time = GNUNET_TIME_absolute_get (); | 532 | start_time = GNUNET_TIME_absolute_get (); |
528 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 533 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -533,13 +538,17 @@ sendtask () | |||
533 | NULL); | 538 | NULL); |
534 | } | 539 | } |
535 | 540 | ||
541 | |||
536 | static void | 542 | static void |
537 | testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) | 543 | testing_connect_cb (struct PeerContext *p1, |
544 | struct PeerContext *p2, | ||
545 | void *cls) | ||
538 | { | 546 | { |
539 | char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id)); | 547 | char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id)); |
540 | 548 | ||
541 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 549 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
542 | "Peers connected: %s <-> %s\n", p1_c, | 550 | "Peers connected: %s <-> %s\n", |
551 | p1_c, | ||
543 | GNUNET_i2s (&p2->id)); | 552 | GNUNET_i2s (&p2->id)); |
544 | GNUNET_free (p1_c); | 553 | GNUNET_free (p1_c); |
545 | 554 | ||
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, |