[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12130 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12130 - gnunet/src/dht |
Date: |
Fri, 2 Jul 2010 18:02:28 +0200 |
Author: nevans
Date: 2010-07-02 18:02:28 +0200 (Fri, 02 Jul 2010)
New Revision: 12130
Modified:
gnunet/src/dht/dht_api.c
gnunet/src/dht/gnunet-service-dht.c
Log:
codesonar fixes, hopefully doesn't break anything
Modified: gnunet/src/dht/dht_api.c
===================================================================
--- gnunet/src/dht/dht_api.c 2010-07-02 16:01:09 UTC (rev 12129)
+++ gnunet/src/dht/dht_api.c 2010-07-02 16:02:28 UTC (rev 12130)
@@ -348,12 +348,11 @@
{
struct PendingMessage *pos = handle->current;
GNUNET_HashCode uid_hash;
- hash_from_uid (pos->unique_id, &uid_hash);
#if DEBUG_DHT_API
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "`%s': Finish called!\n", "DHT API");
#endif
GNUNET_assert (pos != NULL);
-
+ hash_from_uid (pos->unique_id, &uid_hash);
if (pos->cont != NULL)
{
if (code == GNUNET_SYSERR)
@@ -792,7 +791,6 @@
{
struct GNUNET_DHT_FindPeerHandle *find_peer_handle = cls;
struct GNUNET_MessageHeader *hello;
- size_t hello_size;
if (ntohs (reply->type) != GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT)
{
@@ -804,7 +802,6 @@
GNUNET_assert (ntohs (reply->size) >=
sizeof (struct GNUNET_MessageHeader));
- hello_size = ntohs(reply->size) - sizeof(struct GNUNET_MessageHeader);
hello = (struct GNUNET_MessageHeader *)&reply[1];
if (ntohs(hello->type) != GNUNET_MESSAGE_TYPE_HELLO)
@@ -879,10 +876,6 @@
&uid_key, route_handle,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
}
- else
- {
- route_handle->uid = 0;
- }
#if DEBUG_DHT_API
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -909,7 +902,7 @@
handle->current = pending;
process_pending_message (handle);
}
- else if ((handle->current != NULL) && (handle->retransmit_stage ==
DHT_RETRANSMITTING))
+ else if (handle->retransmit_stage == DHT_RETRANSMITTING)
{
handle->retransmit_stage = DHT_RETRANSMITTING_MESSAGE_QUEUED;
handle->retransmission_buffer = pending;
@@ -1009,7 +1002,7 @@
route_handle->dht_handle->current = pending;
process_pending_message (route_handle->dht_handle);
}
- else if ((route_handle->dht_handle->current != NULL) &&
(route_handle->dht_handle->retransmit_stage == DHT_RETRANSMITTING))
+ else if (route_handle->dht_handle->retransmit_stage == DHT_RETRANSMITTING)
{
route_handle->dht_handle->retransmit_stage =
DHT_RETRANSMITTING_MESSAGE_QUEUED;
route_handle->dht_handle->retransmission_buffer = pending;
Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-07-02 16:01:09 UTC (rev 12129)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-07-02 16:02:28 UTC (rev 12130)
@@ -42,7 +42,7 @@
/**
* Handle to the datacache service (for inserting/retrieving data)
*/
-struct GNUNET_DATACACHE_Handle *datacache;
+static struct GNUNET_DATACACHE_Handle *datacache;
/**
* The main scheduler to use for the DHT service
@@ -443,7 +443,12 @@
/* Simplistic find_peer functionality, always return our hello */
hello_size = ntohs(my_hello->size);
tsize = hello_size + sizeof (struct GNUNET_MessageHeader);
- // check tsize < MAX
+
+ if (tsize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ {
+ GNUNET_break_op (0);
+ return;
+ }
find_peer_result = GNUNET_malloc (tsize);
find_peer_result->type = htons (GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT);
find_peer_result->size = htons (tsize);
@@ -604,7 +609,7 @@
* @param client the client we received this message from
* @param message the actual message received
*
- * TODO: once message are remembered by unique id, add code to
+ * TODO: once messages are remembered by unique id, add code to
* forget them here
*/
static void
@@ -800,6 +805,8 @@
"%s Inserting data %s, type %d into datacache, return value
was %d\n", my_short_id, GNUNET_h2s(&peer->hashPubKey), 130, ret);
#endif
}
+ else
+ GNUNET_free(data);
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12130 - gnunet/src/dht,
gnunet <=