struct NeighbourList *next;
struct GNUNET_TIME_Relative retry_time;
struct GNUNET_TIME_Relative duration;
+ GNUNET_CONNECTION_TransmitReadyNotify notify;
if (h->quota_task != GNUNET_SCHEDULER_NO_TASK)
{
th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK;
}
n->transmit_stage = TS_NEW;
- if (NULL != th->notify)
- GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL));
+ if (NULL != (notify = th->notify))
+ {
+ th->notify = NULL;
+ GNUNET_assert (0 == notify (th->notify_cls, 0, NULL));
+ }
continue;
}
if (duration.rel_value > 0)
struct GNUNET_TRANSPORT_TransmitHandle *th;
struct NeighbourList *n;
struct OutboundMessage obm;
+ GNUNET_CONNECTION_TransmitReadyNotify notify;
size_t ret;
size_t mret;
size_t nret;
GNUNET_break (0);
}
GNUNET_assert (size >= sizeof (struct OutboundMessage));
- mret = th->notify (th->notify_cls,
- size - sizeof (struct OutboundMessage),
- &cbuf[ret + sizeof (struct OutboundMessage)]);
+ notify = th->notify;
+ th->notify = NULL;
+ mret = notify (th->notify_cls,
+ size - sizeof (struct OutboundMessage),
+ &cbuf[ret + sizeof (struct OutboundMessage)]);
GNUNET_assert (mret <= size - sizeof (struct OutboundMessage));
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
struct ControlMessage *th = cls;
th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK;
- if (NULL != th->notify)
- th->notify (th->notify_cls, 0, NULL);
+ if (NULL != th->notify)
+ th->notify (th->notify_cls, 0, NULL);
GNUNET_CONTAINER_DLL_remove (th->h->control_head,
th->h->control_tail,
th);
GNUNET_CONNECTION_TransmitReadyNotify notify,
void *notify_cls)
{
- struct ControlMessage *th;
+ struct ControlMessage *cm;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Control transmit of %u bytes within %llums requested\n",
size, (unsigned long long) timeout.rel_value);
#endif
- th = GNUNET_malloc (sizeof (struct ControlMessage));
- th->h = h;
- th->notify = notify;
- th->notify_cls = notify_cls;
- th->notify_size = size;
- th->notify_delay_task
- = GNUNET_SCHEDULER_add_delayed (timeout, &control_transmit_timeout, th);
+ cm = GNUNET_malloc (sizeof (struct ControlMessage));
+ cm->h = h;
+ cm->notify = notify;
+ cm->notify_cls = notify_cls;
+ cm->notify_size = size;
+ cm->notify_delay_task
+ = GNUNET_SCHEDULER_add_delayed (timeout, &control_transmit_timeout, cm);
if (at_head)
GNUNET_CONTAINER_DLL_insert (h->control_head,
h->control_tail,
- th);
+ cm);
else
GNUNET_CONTAINER_DLL_insert_after (h->control_head,
h->control_tail,
h->control_tail,
- th);
+ cm);
schedule_transmission (h);
}
struct NeighbourList *prev;
struct NeighbourList *pos;
+ GNUNET_assert (n->th->notify == NULL);
h = n->h;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
n->is_connected = GNUNET_NO;
if (h->nd_cb != NULL)
h->nd_cb (h->cls, &n->id);
- if (n->transmit_stage == TS_NEW)
+ if (n->transmit_stage == TS_NEW)
neighbour_free (n);
+
}
* @param n the neighbor to send the request connect message about
*
*/
-static void send_request_connect_message(struct GNUNET_TRANSPORT_Handle *h, struct NeighbourList *n)
+static void
+send_request_connect_message(struct GNUNET_TRANSPORT_Handle *h, struct NeighbourList *n)
{
struct TransportRequestConnectMessage *trcm;
{
struct NeighbourList *n;
+ th->notify = NULL;
n = th->neighbour;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
th->notify_size - sizeof (struct OutboundMessage),
GNUNET_i2s (&n->id));
#endif
+ if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel (th->notify_delay_task);
+ th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK;
+ }
switch (n->transmit_stage)
{
case TS_NEW:
default:
GNUNET_break (0);
}
- if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK)
- {
- GNUNET_SCHEDULER_cancel (th->notify_delay_task);
- th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK;
- }
}