}
-/**
- * Allow the MQ implementation to send the next message.
- *
- * @param cls Closure (channel whose mq to activate).
- */
-static void
-cadet_mq_send_continue (void *cls)
-{
- struct GNUNET_CADET_Channel *ch = cls;
-
- ch->mq_cont = NULL;
- GNUNET_assert (NULL == ch->pending_env);
- GNUNET_MQ_impl_send_continue (ch->mq);
-}
-
-
/**
* Transmit the next message from our queue.
*
return;
}
ch->allow_send--;
- GNUNET_MQ_impl_send_in_flight (ch->mq);
ch->pending_env = NULL;
- GNUNET_MQ_notify_sent (env,
- &cadet_mq_send_continue,
- ch);
GNUNET_MQ_send (ch->cadet->mq,
env);
+ GNUNET_MQ_impl_send_continue (ch->mq);
}
GNUNET_assert (NULL != ch->pending_env);
GNUNET_MQ_discard (ch->pending_env);
ch->pending_env = NULL;
+ if (NULL != ch->mq_cont)
+ {
+ GNUNET_SCHEDULER_cancel (ch->mq_cont);
+ ch->mq_cont = NULL;
+ }
}
struct GNUNET_CADET_LocalChannelDestroyMessage *d_msg;
struct GNUNET_MQ_Envelope *env;
- GNUNET_break (0);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"No handler for incoming channel %X (on port %s, recently closed?)\n",
ntohl (ccn.channel_of_client),
struct GNUNET_CADET_Handle *h = cls;
struct GNUNET_CADET_Channel *ch;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Received channel destroy for channel %X from CADET service\n",
- ntohl (msg->ccn.channel_of_client));
ch = find_channel (h,
msg->ccn);
if (NULL == ch)
{
- GNUNET_break (0);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received channel destroy for unknown channel %X from CADET service (recently close?)\n",
+ ntohl (msg->ccn.channel_of_client));
return;
}
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received channel destroy for channel %X from CADET service\n",
+ ntohl (msg->ccn.channel_of_client));
destroy_channel (ch);
}
check_local_data (void *cls,
const struct GNUNET_CADET_LocalData *message)
{
- struct GNUNET_CADET_Handle *h = cls;
- struct GNUNET_CADET_Channel *ch;
uint16_t size;
size = ntohs (message->header.size);
GNUNET_break (0);
return GNUNET_SYSERR;
}
-
- ch = find_channel (h,
- message->ccn);
- if (NULL == ch)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
-
return GNUNET_OK;
}
message->ccn);
if (NULL == ch)
{
- GNUNET_break (0);
- reconnect (h);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Unknown channel %X for incoming data (recently closed?)\n",
+ ntohl (message->ccn.channel_of_client));
return;
}
/* struct GNUNET_CADET_Handle *handle = cls; */
struct GNUNET_CADET_Port *port = value;
+ /* This is a warning, the app should have cleanly closed all open ports */
GNUNET_break (0);
GNUNET_CADET_close_port (port);
return GNUNET_OK;
GNUNET_CONTAINER_multihashmap_remove (p->cadet->ports,
&p->id,
p));
- GNUNET_free (p->handlers);
+ GNUNET_free_non_null (p->handlers);
GNUNET_free (p);
}
p->cls = connects_cls;
p->window_changes = window_changes;
p->disconnects = disconnects;
- if (NULL != handlers)
- {
- unsigned int i;
-
- for (i=0;NULL != handlers[i].cb; i++) ;
- p->handlers = GNUNET_new_array (i + 1,
- struct GNUNET_MQ_MessageHandler);
- GNUNET_memcpy ((struct GNUNET_MQ_MessageHandler *) p->handlers,
- handlers,
- i * sizeof (struct GNUNET_MQ_MessageHandler));
- }
+ p->handlers = GNUNET_MQ_copy_handlers (handlers);
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (h->ports,