diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-28 18:49:25 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-28 18:49:25 +0000 |
commit | 70e4fde281b319ea93a454f8a8fa8a65d08c8969 (patch) | |
tree | c8b909939399d6d5821ed3068d43b10de3d40328 | |
parent | 7e5583d5334f7241686dad86a2110d7d6a7ecfc2 (diff) | |
download | gnunet-70e4fde281b319ea93a454f8a8fa8a65d08c8969.tar.gz gnunet-70e4fde281b319ea93a454f8a8fa8a65d08c8969.zip |
call GNUNET_SERVER_receive_done() also on internal error paths
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 5 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 38 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 12 |
3 files changed, 36 insertions, 19 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 561a62396..17e30c0b7 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -3495,7 +3495,8 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, | |||
3495 | print_ack_state (n->ack_state)); | 3495 | print_ack_state (n->ack_state)); |
3496 | 3496 | ||
3497 | GNUNET_STATISTICS_update (GST_stats, | 3497 | GNUNET_STATISTICS_update (GST_stats, |
3498 | gettext_noop ("# unexpected ACK messages"), 1, | 3498 | gettext_noop ("# unexpected ACK messages"), |
3499 | 1, | ||
3499 | GNUNET_NO); | 3500 | GNUNET_NO); |
3500 | return GNUNET_OK; | 3501 | return GNUNET_OK; |
3501 | } | 3502 | } |
@@ -3510,7 +3511,7 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, | |||
3510 | GNUNET_TRANSPORT_PS_CONNECTED, | 3511 | GNUNET_TRANSPORT_PS_CONNECTED, |
3511 | GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT)); | 3512 | GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT)); |
3512 | 3513 | ||
3513 | /* Reset backoff for primary address */ | 3514 | /* Reset backoff for primary address */ |
3514 | GST_ats_block_reset (n->primary_address.address, | 3515 | GST_ats_block_reset (n->primary_address.address, |
3515 | n->primary_address.session); | 3516 | n->primary_address.session); |
3516 | return GNUNET_OK; | 3517 | return GNUNET_OK; |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 071c08374..bc80dd1bf 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -2147,7 +2147,8 @@ handle_tcp_nat_probe (void *cls, | |||
2147 | if (ntohs (message->size) != sizeof(struct TCP_NAT_ProbeMessage)) | 2147 | if (ntohs (message->size) != sizeof(struct TCP_NAT_ProbeMessage)) |
2148 | { | 2148 | { |
2149 | GNUNET_break_op(0); | 2149 | GNUNET_break_op(0); |
2150 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2150 | GNUNET_SERVER_receive_done (client, |
2151 | GNUNET_SYSERR); | ||
2151 | return; | 2152 | return; |
2152 | } | 2153 | } |
2153 | 2154 | ||
@@ -2156,7 +2157,8 @@ handle_tcp_nat_probe (void *cls, | |||
2156 | sizeof(struct GNUNET_PeerIdentity))) | 2157 | sizeof(struct GNUNET_PeerIdentity))) |
2157 | { | 2158 | { |
2158 | /* refuse connections from ourselves */ | 2159 | /* refuse connections from ourselves */ |
2159 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2160 | GNUNET_SERVER_receive_done (client, |
2161 | GNUNET_SYSERR); | ||
2160 | return; | 2162 | return; |
2161 | } | 2163 | } |
2162 | 2164 | ||
@@ -2166,7 +2168,8 @@ handle_tcp_nat_probe (void *cls, | |||
2166 | { | 2168 | { |
2167 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2169 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2168 | "Did NOT find session for NAT probe!\n"); | 2170 | "Did NOT find session for NAT probe!\n"); |
2169 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2171 | GNUNET_SERVER_receive_done (client, |
2172 | GNUNET_OK); | ||
2170 | return; | 2173 | return; |
2171 | } | 2174 | } |
2172 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2175 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2235,7 +2238,8 @@ handle_tcp_nat_probe (void *cls, | |||
2235 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 2238 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
2236 | "Bad address for incoming connection!\n"); | 2239 | "Bad address for incoming connection!\n"); |
2237 | GNUNET_free(vaddr); | 2240 | GNUNET_free(vaddr); |
2238 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2241 | GNUNET_SERVER_receive_done (client, |
2242 | GNUNET_SYSERR); | ||
2239 | tcp_plugin_disconnect_session (plugin, | 2243 | tcp_plugin_disconnect_session (plugin, |
2240 | session); | 2244 | session); |
2241 | return; | 2245 | return; |
@@ -2354,6 +2358,8 @@ handle_tcp_welcome (void *cls, | |||
2354 | { | 2358 | { |
2355 | GNUNET_break (0); | 2359 | GNUNET_break (0); |
2356 | GNUNET_free_non_null (vaddr); | 2360 | GNUNET_free_non_null (vaddr); |
2361 | GNUNET_SERVER_receive_done (client, | ||
2362 | GNUNET_SYSERR); | ||
2357 | return; | 2363 | return; |
2358 | } | 2364 | } |
2359 | session = create_session (plugin, | 2365 | session = create_session (plugin, |
@@ -2391,6 +2397,8 @@ handle_tcp_welcome (void *cls, | |||
2391 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 2397 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
2392 | "Did not obtain TCP socket address for incoming connection\n"); | 2398 | "Did not obtain TCP socket address for incoming connection\n"); |
2393 | GNUNET_break(0); | 2399 | GNUNET_break(0); |
2400 | GNUNET_SERVER_receive_done (client, | ||
2401 | GNUNET_SYSERR); | ||
2394 | return; | 2402 | return; |
2395 | } | 2403 | } |
2396 | } | 2404 | } |
@@ -2398,7 +2406,8 @@ handle_tcp_welcome (void *cls, | |||
2398 | if (session->expecting_welcome != GNUNET_YES) | 2406 | if (session->expecting_welcome != GNUNET_YES) |
2399 | { | 2407 | { |
2400 | GNUNET_break_op(0); | 2408 | GNUNET_break_op(0); |
2401 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2409 | GNUNET_SERVER_receive_done (client, |
2410 | GNUNET_SYSERR); | ||
2402 | GNUNET_break(0); | 2411 | GNUNET_break(0); |
2403 | return; | 2412 | return; |
2404 | } | 2413 | } |
@@ -2408,7 +2417,8 @@ handle_tcp_welcome (void *cls, | |||
2408 | process_pending_messages (session); | 2417 | process_pending_messages (session); |
2409 | GNUNET_SERVER_client_set_timeout (client, | 2418 | GNUNET_SERVER_client_set_timeout (client, |
2410 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 2419 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
2411 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2420 | GNUNET_SERVER_receive_done (client, |
2421 | GNUNET_OK); | ||
2412 | } | 2422 | } |
2413 | 2423 | ||
2414 | 2424 | ||
@@ -2502,17 +2512,21 @@ handle_tcp_data (void *cls, | |||
2502 | reschedule_session_timeout (session); | 2512 | reschedule_session_timeout (session); |
2503 | if (0 == delay.rel_value_us) | 2513 | if (0 == delay.rel_value_us) |
2504 | { | 2514 | { |
2505 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2515 | GNUNET_SERVER_receive_done (client, |
2516 | GNUNET_OK); | ||
2506 | } | 2517 | } |
2507 | else | 2518 | else |
2508 | { | 2519 | { |
2509 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 2520 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2510 | "Throttling receiving from `%s' for %s\n", | 2521 | "Throttling receiving from `%s' for %s\n", |
2511 | GNUNET_i2s (&session->target), | 2522 | GNUNET_i2s (&session->target), |
2512 | GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES)); | 2523 | GNUNET_STRINGS_relative_time_to_string (delay, |
2524 | GNUNET_YES)); | ||
2513 | GNUNET_SERVER_disable_receive_done_warning (client); | 2525 | GNUNET_SERVER_disable_receive_done_warning (client); |
2526 | GNUNET_assert (NULL == session->receive_delay_task); | ||
2514 | session->receive_delay_task = GNUNET_SCHEDULER_add_delayed (delay, | 2527 | session->receive_delay_task = GNUNET_SCHEDULER_add_delayed (delay, |
2515 | &delayed_done, session); | 2528 | &delayed_done, |
2529 | session); | ||
2516 | } | 2530 | } |
2517 | } | 2531 | } |
2518 | 2532 | ||
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 8c6a0d854..a5db667b7 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1929,7 +1929,9 @@ enqueue (struct Plugin *plugin, | |||
1929 | else | 1929 | else |
1930 | { | 1930 | { |
1931 | GNUNET_STATISTICS_update (plugin->env->stats, | 1931 | GNUNET_STATISTICS_update (plugin->env->stats, |
1932 | "# UDP, total, bytes in buffers", udpw->msg_size, GNUNET_NO); | 1932 | "# UDP, total, bytes in buffers", |
1933 | udpw->msg_size, | ||
1934 | GNUNET_NO); | ||
1933 | plugin->bytes_in_buffer += udpw->msg_size; | 1935 | plugin->bytes_in_buffer += udpw->msg_size; |
1934 | } | 1936 | } |
1935 | GNUNET_STATISTICS_update (plugin->env->stats, | 1937 | GNUNET_STATISTICS_update (plugin->env->stats, |
@@ -2509,9 +2511,10 @@ read_process_ack (struct Plugin *plugin, | |||
2509 | 2511 | ||
2510 | flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay); | 2512 | flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay); |
2511 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2513 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2512 | "We received a sending delay of %s\n", | 2514 | "We received a sending delay of %s for %s\n", |
2513 | GNUNET_STRINGS_relative_time_to_string (flow_delay, | 2515 | GNUNET_STRINGS_relative_time_to_string (flow_delay, |
2514 | GNUNET_YES)); | 2516 | GNUNET_YES), |
2517 | GNUNET_i2s (&udp_ack->sender)); | ||
2515 | s->flow_delay_from_other_peer = GNUNET_TIME_relative_to_absolute (flow_delay); | 2518 | s->flow_delay_from_other_peer = GNUNET_TIME_relative_to_absolute (flow_delay); |
2516 | 2519 | ||
2517 | ack = (const struct GNUNET_MessageHeader *) &udp_ack[1]; | 2520 | ack = (const struct GNUNET_MessageHeader *) &udp_ack[1]; |
@@ -2537,8 +2540,7 @@ read_process_ack (struct Plugin *plugin, | |||
2537 | } | 2540 | } |
2538 | 2541 | ||
2539 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2542 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2540 | "Message full ACK'ed\n", | 2543 | "Message from %s at %s full ACK'ed\n", |
2541 | (unsigned int ) ntohs (msg->size), | ||
2542 | GNUNET_i2s (&udp_ack->sender), | 2544 | GNUNET_i2s (&udp_ack->sender), |
2543 | udp_address_to_string (plugin, | 2545 | udp_address_to_string (plugin, |
2544 | udp_addr, | 2546 | udp_addr, |