handle->current = NULL;
process_pending_message (handle);
+ GNUNET_free(pos->msg);
GNUNET_free (pos);
}
last = pos;
pos = pos->next;
}
- new_message->next = last->next; /* Should always be null */
last->next = new_message;
}
else
{
- new_message->next = handle->pending_list; /* Will always be null */
handle->pending_list = new_message;
}
GNUNET_HashCode uidhash;
struct SendCallbackContext *send_ctx;
-#if DEBUG_DV
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "dv api receives message!\n");
-#endif
-
if (msg == NULL)
{
return; /* Connection closed? */
sender_address_len = ntohl(received_msg->sender_address_len);
GNUNET_assert(ntohs(msg->size) == (sizeof(struct GNUNET_DV_MessageReceived) + packed_msg_len + sender_address_len));
-#if DEBUG_DV
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "dv api receives message, size checks out!\n");
-#endif
sender_address = GNUNET_malloc(sender_address_len);
memcpy(sender_address, &received_msg[1], sender_address_len);
packed_msg_start = (char *)&received_msg[1];
send_result_msg = (struct GNUNET_DV_SendResultMessage *)msg;
hash_from_uid(ntohl(send_result_msg->uid), &uidhash);
send_ctx = GNUNET_CONTAINER_multihashmap_get(handle->send_callbacks, &uidhash);
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "got uid of %u or %u, hash of %s !!!!\n", ntohl(send_result_msg->uid), send_result_msg->uid, GNUNET_h2s(&uidhash));
if ((send_ctx != NULL) && (send_ctx->cont != NULL))
{
-#if DEBUG_DV
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "dv api notifies transport of send result (%u)!\n", ntohl(send_result_msg->result));
-#endif
if (ntohl(send_result_msg->result) == 0)
{
send_ctx->cont(send_ctx->cont_cls, &send_ctx->target, GNUNET_OK);
struct SendCallbackContext *send_ctx;
char *end_of_message;
GNUNET_HashCode uidhash;
+ int msize;
#if DEBUG_DV_MESSAGES
dv_handle->uid_gen = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, UINT32_MAX);
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "GNUNET_DV_send called with message of size %d, address size %d, total size %d, uid %u\n", msgbuf_size, addrlen, sizeof(struct GNUNET_DV_SendMessage) + msgbuf_size + addrlen, dv_handle->uid_gen);
#else
dv_handle->uid_gen++;
#endif
- msg = GNUNET_malloc(sizeof(struct GNUNET_DV_SendMessage) + addrlen + msgbuf_size);
- msg->header.size = htons(sizeof(struct GNUNET_DV_SendMessage) + addrlen + msgbuf_size);
+ msize = sizeof(struct GNUNET_DV_SendMessage) + addrlen + msgbuf_size;
+ msg = GNUNET_malloc(msize);
+ msg->header.size = htons(msize);
msg->header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_DV_SEND);
memcpy(&msg->target, target, sizeof(struct GNUNET_PeerIdentity));
msg->msgbuf_size = htonl(msgbuf_size);
if (size >= tsize)
{
memcpy(buf, start_context->message, tsize);
+ GNUNET_free(start_context->message);
+ GNUNET_free(start_context);
return tsize;
}