[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21407 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21407 - gnunet/src/transport |
Date: |
Thu, 10 May 2012 12:07:55 +0200 |
Author: grothoff
Date: 2012-05-10 12:07:55 +0200 (Thu, 10 May 2012)
New Revision: 21407
Modified:
gnunet/src/transport/plugin_transport_udp.c
Log:
-fixing UDP fix
Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2012-05-10 10:02:21 UTC (rev
21406)
+++ gnunet/src/transport/plugin_transport_udp.c 2012-05-10 10:07:55 UTC (rev
21407)
@@ -119,6 +119,8 @@
struct FragmentationContext * frag_ctx;
+ unsigned int rc;
+
int in_destroy;
};
@@ -617,15 +619,11 @@
/**
* Task to free resources associated with a session.
*
- * @param cls the 'struct Session' to free
- * @param tc scheduler context (unused)
+ * @param s session to free
*/
static void
-free_session (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+free_session (struct Session *s)
{
- struct Session *s = cls;
-
if (s->frag_ctx != NULL)
{
GNUNET_FRAGMENT_context_destroy(s->frag_ctx->frag);
@@ -693,8 +691,10 @@
"# UDP sessions active",
GNUNET_CONTAINER_multihashmap_size(plugin->sessions),
GNUNET_NO);
- GNUNET_SCHEDULER_add_now (&free_session, s);
- s->in_destroy = GNUNET_YES;
+ if (s->rc > 0)
+ s->in_destroy = GNUNET_YES;
+ else
+ free_session (s);
return GNUNET_OK;
}
@@ -1265,7 +1265,7 @@
socklen_t sender_addr_len)
{
struct SourceInformation si;
- struct Session * s = NULL;
+ struct Session * s;
struct IPv4UdpAddress u4;
struct IPv6UdpAddress u6;
const void *arg;
@@ -1318,10 +1318,13 @@
si.sender = msg->sender;
si.arg = arg;
si.args = args;
-
+ s->rc++;
GNUNET_SERVER_mst_receive (plugin->mst, &si, (const char *) &msg[1],
ntohs (msg->header.size) -
sizeof (struct UDPMessage), GNUNET_YES,
GNUNET_NO);
+ s->rc--;
+ if ( (0 == s->rc) && (GNUNET_YES == s->in_destroy))
+ free_session (s);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21407 - gnunet/src/transport,
gnunet <=