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 /src/transport/plugin_transport_tcp.c | |
parent | 7e5583d5334f7241686dad86a2110d7d6a7ecfc2 (diff) | |
download | gnunet-70e4fde281b319ea93a454f8a8fa8a65d08c8969.tar.gz gnunet-70e4fde281b319ea93a454f8a8fa8a65d08c8969.zip |
call GNUNET_SERVER_receive_done() also on internal error paths
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 38 |
1 files changed, 26 insertions, 12 deletions
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 | ||