{
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)
{
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)
{
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)
&uid_key, route_handle,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
}
- else
- {
- route_handle->uid = 0;
- }
#if DEBUG_DHT_API
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
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;
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;
/**
* 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
/* 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);
* @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
"%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);
}
/**