[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21393 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21393 - gnunet/src/util |
Date: |
Wed, 9 May 2012 20:27:14 +0200 |
Author: grothoff
Date: 2012-05-09 20:27:14 +0200 (Wed, 09 May 2012)
New Revision: 21393
Modified:
gnunet/src/util/server.c
Log:
-fixing #2329
Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c 2012-05-09 16:44:37 UTC (rev 21392)
+++ gnunet/src/util/server.c 2012-05-09 18:27:14 UTC (rev 21393)
@@ -1252,6 +1252,25 @@
/**
+ * Destroy the connection that is passed in via 'cls'. Used
+ * as calling 'GNUNET_CONNECTION_destroy' from within a function
+ * that was itself called from within 'process_notify' of
+ * 'connection.c' is not allowed (see #2329).
+ *
+ * @param cls connection to destroy
+ * @param tc scheduler context (unused)
+ */
+static void
+destroy_connection (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct GNUNET_CONNECTION_Handle *connection = cls;
+
+ GNUNET_CONNECTION_destroy (connection);
+}
+
+
+/**
* Ask the server to disconnect from the given client.
* This is the same as returning GNUNET_SYSERR from a message
* handler, except that it allows dropping of a client even
@@ -1338,7 +1357,8 @@
GNUNET_CONNECTION_persist_ (client->connection);
if (NULL != client->th.cth)
GNUNET_SERVER_notify_transmit_ready_cancel (&client->th);
- GNUNET_CONNECTION_destroy (client->connection);
+ (void) GNUNET_SCHEDULER_add_now (&destroy_connection,
+ client->connection);
GNUNET_free (client);
/* we might be in soft-shutdown, test if we're done */
if (NULL != server)
@@ -1375,14 +1395,12 @@
{
struct GNUNET_SERVER_Client *client = cls;
GNUNET_CONNECTION_TransmitReadyNotify callback;
- size_t ret;
client->th.cth = NULL;
callback = client->th.callback;
client->th.callback = NULL;
client->last_activity = GNUNET_TIME_absolute_get ();
- ret = callback (client->th.callback_cls, size, buf);
- return ret;
+ return callback (client->th.callback_cls, size, buf);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21393 - gnunet/src/util,
gnunet <=