aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-03-07 10:33:47 +0000
committerChristian Grothoff <christian@grothoff.org>2015-03-07 10:33:47 +0000
commitb80ca38067a55ae8588446ad47ecc7af65abefcc (patch)
treef58e674917026c236441584d2d4bed123edcbdc6 /src/transport/plugin_transport_udp.c
parent1aebcd292bfe9863fe1609ed6c055e4db83cce9f (diff)
downloadgnunet-b80ca38067a55ae8588446ad47ecc7af65abefcc.tar.gz
gnunet-b80ca38067a55ae8588446ad47ecc7af65abefcc.zip
trying to fix #3702 by removing session from session map earlier -- and adding additional check for messages being enqueued for destroyed sessions
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index c5542d200..9c9db06ae 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1456,6 +1456,11 @@ enqueue (struct Plugin *plugin,
1456{ 1456{
1457 struct Session *session = udpw->session; 1457 struct Session *session = udpw->session;
1458 1458
1459 if (GNUNET_YES == session->in_destroy)
1460 {
1461 GNUNET_break (0);
1462 return;
1463 }
1459 if (plugin->bytes_in_buffer + udpw->msg_size > INT64_MAX) 1464 if (plugin->bytes_in_buffer + udpw->msg_size > INT64_MAX)
1460 { 1465 {
1461 GNUNET_break (0); 1466 GNUNET_break (0);
@@ -2174,7 +2179,10 @@ udp_disconnect_session (void *cls,
2174 fragmented_message_done (s->frag_ctx, 2179 fragmented_message_done (s->frag_ctx,
2175 GNUNET_SYSERR); 2180 GNUNET_SYSERR);
2176 } 2181 }
2177 2182 GNUNET_assert (GNUNET_YES ==
2183 GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
2184 &s->target,
2185 s));
2178 frc.rc = NULL; 2186 frc.rc = NULL;
2179 frc.udp_addr = s->address->address; 2187 frc.udp_addr = s->address->address;
2180 frc.udp_addr_len = s->address->address_length; 2188 frc.udp_addr_len = s->address->address_length;
@@ -2193,6 +2201,7 @@ udp_disconnect_session (void *cls,
2193 GNUNET_free (d_ctx); 2201 GNUNET_free (d_ctx);
2194 } 2202 }
2195 } 2203 }
2204 s->in_destroy = GNUNET_YES;
2196 next = plugin->ipv4_queue_head; 2205 next = plugin->ipv4_queue_head;
2197 while (NULL != (udpw = next)) 2206 while (NULL != (udpw = next))
2198 { 2207 {
@@ -2221,13 +2230,6 @@ udp_disconnect_session (void *cls,
2221 GNUNET_free (udpw); 2230 GNUNET_free (udpw);
2222 } 2231 }
2223 } 2232 }
2224 notify_session_monitor (s->plugin,
2225 s,
2226 GNUNET_TRANSPORT_SS_DONE);
2227 plugin->env->session_end (plugin->env->cls,
2228 s->address,
2229 s);
2230
2231 if ( (NULL != s->frag_ctx) && 2233 if ( (NULL != s->frag_ctx) &&
2232 (NULL != s->frag_ctx->cont) ) 2234 (NULL != s->frag_ctx->cont) )
2233 { 2235 {
@@ -2242,23 +2244,18 @@ udp_disconnect_session (void *cls,
2242 s->frag_ctx->payload_size, 2244 s->frag_ctx->payload_size,
2243 s->frag_ctx->on_wire_size); 2245 s->frag_ctx->on_wire_size);
2244 } 2246 }
2245 2247 notify_session_monitor (s->plugin,
2246 GNUNET_assert (GNUNET_YES == 2248 s,
2247 GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, 2249 GNUNET_TRANSPORT_SS_DONE);
2248 &s->target, 2250 plugin->env->session_end (plugin->env->cls,
2249 s)); 2251 s->address,
2252 s);
2250 GNUNET_STATISTICS_set (plugin->env->stats, 2253 GNUNET_STATISTICS_set (plugin->env->stats,
2251 "# UDP sessions active", 2254 "# UDP sessions active",
2252 GNUNET_CONTAINER_multipeermap_size (plugin->sessions), 2255 GNUNET_CONTAINER_multipeermap_size (plugin->sessions),
2253 GNUNET_NO); 2256 GNUNET_NO);
2254 if (s->rc > 0) 2257 if (0 == s->rc)
2255 {
2256 s->in_destroy = GNUNET_YES;
2257 }
2258 else
2259 {
2260 free_session (s); 2258 free_session (s);
2261 }
2262 return GNUNET_OK; 2259 return GNUNET_OK;
2263} 2260}
2264 2261