GNUNET_assert (n->transmit_handle == th);
n->transmit_handle = NULL;
}
+ if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel (h->sched,
+ th->notify_delay_task);
+ th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK;
+ }
GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL));
GNUNET_free (th);
+ if (h->connect_ready_head != NULL) schedule_transmission (h); /* FIXME: is this ok? */
return 0;
}
#if DEBUG_TRANSPORT
th = h->connect_ready_head;
if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK)
{
- /* remove existing time out task (only applies if
- this is not the first iteration of the loop) */
GNUNET_SCHEDULER_cancel (h->sched,
th->notify_delay_task);
th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK;
* TransmitHandle.
*/
static void
-transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+peer_transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_TRANSPORT_TransmitHandle *th = cls;
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
timeout,
- &transmit_timeout, th);
+ &peer_transmit_timeout, th);
if (at_head)
{
th->next = h->connect_ready_head;
"TRY_CONNECT",
GNUNET_i2s(&th->target));
#endif
+ if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel (h->sched, th->notify_delay_task);
+ th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK;
+ }
th->notify (th->notify_cls, 0, NULL);
GNUNET_free (th);
return 0;
GNUNET_SCHEDULER_NO_TASK,
GNUNET_TIME_absolute_get_remaining
(th->timeout),
- &transmit_timeout, th);
+ &peer_transmit_timeout, th);
insert_transmit_handle (&h->connect_wait_head, th);
return sizeof (struct TryConnectMessage);
}
{
/* signal error */
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == th->notify_delay_task);
- transmit_timeout (th, NULL);
+ peer_transmit_timeout (th, NULL);
}
else
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Connection with `%4s' failed, will keep trying for %llu ms to deliver message\n"),
+ GNUNET_i2s (peer),
+ GNUNET_TIME_absolute_get_remaining (th->timeout).value);
/* try again in a bit */
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == th->notify_delay_task);
th->notify_delay_task
struct GNUNET_TRANSPORT_TransmitHandle *pos;
struct NeighbourList *n;
+ fprintf (stderr,
+ "Trying to reconnect to transport!\n");
+
/* Forget about all neighbours that we used to be connected
to */
while (NULL != (n = h->neighbours))
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
GNUNET_TIME_absolute_get_remaining
- (th->timeout), &transmit_timeout, th);
+ (th->timeout), &peer_transmit_timeout, th);
return;
}
n->transmit_ok = GNUNET_NO;
struct GNUNET_CLIENT_Connection *client;
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transport disconnect called!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transport disconnect called!\n");
#endif
while (NULL != (th = handle->connect_ready_head))
{
handle->connect_ready_head = th->next;
+ GNUNET_assert (th->notify_delay_task == GNUNET_SCHEDULER_NO_TASK);
th->notify (th->notify_cls, 0, NULL);
GNUNET_free (th);
}
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
GNUNET_TIME_absolute_get_remaining(th->timeout),
- &transmit_timeout,
+ &peer_transmit_timeout,
th);
}
GNUNET_CLIENT_disconnect (h->client);
GNUNET_NO,
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
- timeout, &transmit_timeout, th);
+ timeout, &peer_transmit_timeout, th);
return th;
}
/**
- * Cancel the specified transmission-ready
- * notification.
+ * Cancel the specified transmission-ready notification.
*/
void
GNUNET_TRANSPORT_notify_transmit_ready_cancel (struct
h->transmission_scheduled = GNUNET_NO;
}
GNUNET_free (th->notify_cls);
+ GNUNET_assert (th->notify_delay_task == GNUNET_SCHEDULER_NO_TASK);
GNUNET_free (th);
}