[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35294 - in gnunet/src: include util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35294 - in gnunet/src: include util |
Date: |
Sat, 21 Feb 2015 21:43:27 +0100 |
Author: grothoff
Date: 2015-02-21 21:43:27 +0100 (Sat, 21 Feb 2015)
New Revision: 35294
Modified:
gnunet/src/include/gnunet_server_lib.h
gnunet/src/util/connection.c
gnunet/src/util/server.c
Log:
fix TCP plugin RC issue (#3687) by changing util API (!)
Modified: gnunet/src/include/gnunet_server_lib.h
===================================================================
--- gnunet/src/include/gnunet_server_lib.h 2015-02-21 20:22:05 UTC (rev
35293)
+++ gnunet/src/include/gnunet_server_lib.h 2015-02-21 20:43:27 UTC (rev
35294)
@@ -394,8 +394,7 @@
* @param server the server to use
* @param connection the connection to manage (client must
* stop using this connection from now on)
- * @return the client handle (client should call
- * #GNUNET_SERVER_client_drop on the return value eventually)
+ * @return the client handle
*/
struct GNUNET_SERVER_Client *
GNUNET_SERVER_connect_socket (struct GNUNET_SERVER_Handle *server,
Modified: gnunet/src/util/connection.c
===================================================================
--- gnunet/src/util/connection.c 2015-02-21 20:22:05 UTC (rev 35293)
+++ gnunet/src/util/connection.c 2015-02-21 20:43:27 UTC (rev 35294)
@@ -421,9 +421,11 @@
if (GNUNET_NO == aret)
LOG (GNUNET_ERROR_TYPE_INFO,
_("Access denied to `%s'\n"),
- GNUNET_a2s (uaddr, addrlen));
+ GNUNET_a2s (uaddr,
+ addrlen));
GNUNET_break (GNUNET_OK ==
- GNUNET_NETWORK_socket_shutdown (sock, SHUT_RDWR));
+ GNUNET_NETWORK_socket_shutdown (sock,
+ SHUT_RDWR));
GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
GNUNET_free (uaddr);
return NULL;
@@ -525,7 +527,8 @@
connection);
if (NULL != connection->sock)
{
- (void) GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR);
+ (void) GNUNET_NETWORK_socket_shutdown (connection->sock,
+ SHUT_RDWR);
GNUNET_break (GNUNET_OK ==
GNUNET_NETWORK_socket_close (connection->sock));
connection->sock = NULL;
@@ -1301,14 +1304,17 @@
* @param tc task context describing why we are here
*/
static void
-transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_ready (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_CONNECTION_Handle *connection = cls;
GNUNET_CONNECTION_TransmitReadyNotify notify;
ssize_t ret;
size_t have;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "transmit_ready running (%p).\n", connection);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "transmit_ready running (%p).\n",
+ connection);
GNUNET_assert (NULL != connection->write_task);
connection->write_task = NULL;
GNUNET_assert (NULL == connection->nth.timeout_task);
@@ -1331,7 +1337,9 @@
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Transmit to `%s' fails, time out reached (%p).\n",
- GNUNET_a2s (connection->addr, connection->addrlen), connection);
+ GNUNET_a2s (connection->addr,
+ connection->addrlen),
+ connection);
notify = connection->nth.notify_ready;
GNUNET_assert (NULL != notify);
connection->nth.notify_ready = NULL;
Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c 2015-02-21 20:22:05 UTC (rev 35293)
+++ gnunet/src/util/server.c 2015-02-21 20:43:27 UTC (rev 35294)
@@ -397,7 +397,6 @@
{
struct GNUNET_SERVER_Handle *server = cls;
struct GNUNET_CONNECTION_Handle *sock;
- struct GNUNET_SERVER_Client *client;
unsigned int i;
server->listen_task = NULL;
@@ -420,9 +419,8 @@
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Server accepted incoming connection.\n");
- client = GNUNET_SERVER_connect_socket (server, sock);
- /* decrement reference count, we don't keep "client" alive */
- GNUNET_SERVER_client_drop (client);
+ (void) GNUNET_SERVER_connect_socket (server,
+ sock);
}
}
i++;
@@ -1235,13 +1233,14 @@
* received a complete message.
*
* @param cls closure (struct GNUNET_SERVER_Handle)
- * @param client identification of the client (struct GNUNET_SERVER_Client*)
+ * @param client identification of the client (`struct GNUNET_SERVER_Client *`)
* @param message the actual message
*
* @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
*/
static int
-client_message_tokenizer_callback (void *cls, void *client,
+client_message_tokenizer_callback (void *cls,
+ void *client,
const struct GNUNET_MessageHeader *message)
{
struct GNUNET_SERVER_Handle *server = cls;
@@ -1272,8 +1271,7 @@
* @param server the server to use
* @param connection the connection to manage (client must
* stop using this connection from now on)
- * @return the client handle (client should call
- * "client_drop" on the return value eventually)
+ * @return the client handle
*/
struct GNUNET_SERVER_Client *
GNUNET_SERVER_connect_socket (struct GNUNET_SERVER_Handle *server,
@@ -1284,7 +1282,6 @@
client = GNUNET_new (struct GNUNET_SERVER_Client);
client->connection = connection;
- client->reference_count = 1;
client->server = server;
client->last_activity = GNUNET_TIME_absolute_get ();
client->idle_timeout = server->idle_timeout;
@@ -1491,7 +1488,7 @@
/**
* Destroy the connection that is passed in via @a cls. Used
* as calling #GNUNET_CONNECTION_destroy from within a function
- * that was itself called from within 'process_notify' of
+ * that was itself called from within process_notify() of
* 'connection.c' is not allowed (see #2329).
*
* @param cls connection to destroy
@@ -1547,27 +1544,34 @@
server->clients_tail,
client);
if (NULL != server->mst_destroy)
- server->mst_destroy (server->mst_cls, client->mst);
+ server->mst_destroy (server->mst_cls,
+ client->mst);
else
GNUNET_SERVER_mst_destroy (client->mst);
client->mst = NULL;
for (n = server->disconnect_notify_list_head; NULL != n; n = n->next)
- n->callback (n->callback_cls, client);
+ n->callback (n->callback_cls,
+ client);
}
client->reference_count--;
if (client->reference_count > 0)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "RC still positive, not destroying everything.\n");
+ "RC of %p still positive, not destroying everything.\n",
+ client);
client->server = NULL;
return;
}
if (GNUNET_YES == client->in_process_client_buffer)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Still processing inputs, not destroying everything.\n");
+ "Still processing inputs of %p, not destroying everything.\n",
+ client);
return;
}
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "RC of %p now zero, destroying everything.\n",
+ client);
if (GNUNET_YES == client->persist)
GNUNET_CONNECTION_persist_ (client->connection);
if (NULL != client->th.cth)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35294 - in gnunet/src: include util,
gnunet <=