[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16616 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16616 - gnunet/src/transport |
Date: |
Fri, 26 Aug 2011 13:52:11 +0200 |
Author: wachs
Date: 2011-08-26 13:52:11 +0200 (Fri, 26 Aug 2011)
New Revision: 16616
Modified:
gnunet/src/transport/gnunet-service-transport_clients.c
Log:
fixed assertion in clients_handle_start():390
it is not possible to compare GNUNET_SERVER_Clients in lookup_client by
comparing memory addresses since memory blocks are reused by server_lib
-> added unique id for each GNUNET_SERVER_Client
Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c 2011-08-26
11:42:39 UTC (rev 16615)
+++ gnunet/src/transport/gnunet-service-transport_clients.c 2011-08-26
11:52:11 UTC (rev 16616)
@@ -109,6 +109,10 @@
*/
unsigned int message_count;
+ /**
+ * GNUNET_SERVER_Client's unique id
+ */
+ uint64_t server_client_id;
};
@@ -122,7 +126,6 @@
*/
static struct TransportClient *clients_tail;
-
/**
* Find the internal handle associated with the given client handle
*
@@ -137,7 +140,7 @@
tc = clients_head;
while (tc != NULL)
{
- if (tc->client == client)
+ if (tc->server_client_id == GNUNET_SERVER_client_get_id (client))
return tc;
tc = tc->next;
}
@@ -156,8 +159,12 @@
{
struct TransportClient *tc;
+ GNUNET_assert (lookup_client (client) == NULL);
+
tc = GNUNET_malloc (sizeof (struct TransportClient));
tc->client = client;
+ tc->server_client_id = GNUNET_SERVER_client_get_id (client);
+
GNUNET_CONTAINER_DLL_insert (clients_head, clients_tail, tc);
return tc;
}
@@ -202,8 +209,8 @@
break;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmitting message of type %u to client.\n",
- ntohs (msg->type));
+ "Transmitting message of type %u to client %X.\n",
+ ntohs (msg->type), tc);
#endif
GNUNET_CONTAINER_DLL_remove (tc->message_queue_head,
tc->message_queue_tail,
q);
@@ -289,7 +296,7 @@
return;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
- "Client disconnected, cleaning up.\n");
+ "Client %X disconnected, cleaning up.\n", tc);
#endif
while (NULL != (mqe = tc->message_queue_head))
{
@@ -361,9 +368,25 @@
struct TransportClient *tc;
tc = lookup_client (client);
+
+#if DEBUG_TRANSPORT
if (tc != NULL)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
+ "Client %X sent START\n", tc);
+ else
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
+ "Client %X sent START\n", tc);
+#endif
+ if (tc != NULL)
{
/* got 'start' twice from the same client, not allowed */
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
+ "TransportClient %X ServerClient %X id %llu sent multiple
START messages\n",
+ tc,
+ tc->client,
+ tc->server_client_id);
+#endif
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
@@ -383,6 +406,7 @@
return;
}
tc = setup_client (client);
+
unicast (tc, GST_hello_get (), GNUNET_NO);
GST_neighbours_iterate (¬ify_client_about_neighbour, tc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -495,7 +519,8 @@
/* not connected, not allowed to send; can happen due to asynchronous
operations */
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Could not send message to peer `%s': not connected\n",
GNUNET_i2s (&obm->peer));
+ "Could not send message to peer `%s': not connected\n",
+ GNUNET_i2s (&obm->peer));
#endif
GNUNET_STATISTICS_update (GST_stats,
gettext_noop
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16616 - gnunet/src/transport,
gnunet <=