pr));
GNUNET_MQ_destroy (pr->mq);
GNUNET_assert (NULL == pr->mq);
+ if (NULL != pr->env)
+ {
+ GNUNET_MQ_discard (pr->env);
+ pr->env = NULL;
+ }
GNUNET_free (pr);
return GNUNET_YES;
}
{
struct GNUNET_CORE_Handle *h = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "MQ ERROR: %d\n",
- error);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "MQ ERROR: %d\n",
+ error);
reconnect_later (h);
}
env = GNUNET_MQ_msg (smr,
GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST);
smr->priority = htonl ((uint32_t) priority);
- // smr->deadline = GNUNET_TIME_absolute_hton (deadline);
smr->peer = pr->peer;
smr->reserved = htonl (0);
smr->size = htons (msize);
GNUNET_MESSAGE_TYPE_CORE_SEND,
msg);
sm->priority = htonl ((uint32_t) priority);
- // sm->deadline = GNUNET_TIME_absolute_hton (deadline);
sm->peer = pr->peer;
sm->cork = htonl ((uint32_t) cork);
sm->reserved = htonl (0);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Calling get_message with buffer of %u bytes (%s)\n",
- (unsigned int) msize,
- cork ? "corked" : "uncorked");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Calling get_message with buffer of %u bytes (%s)\n",
+ (unsigned int) msize,
+ cork ? "corked" : "uncorked");
}
const struct GNUNET_MQ_MessageHandler *handlers)
{
struct GNUNET_CORE_Handle *h;
- unsigned int hcnt;
h = GNUNET_new (struct GNUNET_CORE_Handle);
h->cfg = cfg;
h->disconnects = disconnects;
h->peers = GNUNET_CONTAINER_multipeermap_create (128,
GNUNET_NO);
- hcnt = 0;
- if (NULL != handlers)
- while (NULL != handlers[hcnt].cb)
- hcnt++;
- h->handlers = GNUNET_new_array (hcnt + 1,
- struct GNUNET_MQ_MessageHandler);
- if (NULL != handlers)
- GNUNET_memcpy (h->handlers,
- handlers,
- hcnt * sizeof (struct GNUNET_MQ_MessageHandler));
- h->hcnt = hcnt;
- GNUNET_assert (hcnt <
+ h->handlers = GNUNET_MQ_copy_handlers (handlers);
+ h->hcnt = GNUNET_MQ_count_handlers (handlers);
+ GNUNET_assert (h->hcnt <
(GNUNET_SERVER_MAX_MESSAGE_SIZE -
sizeof (struct InitMessage)) / sizeof (uint16_t));
LOG (GNUNET_ERROR_TYPE_DEBUG,
GNUNET_MQ_destroy (handle->mq);
handle->mq = NULL;
}
- GNUNET_free (handle->handlers);
+ GNUNET_free_non_null (handle->handlers);
GNUNET_free (handle);
}