projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
backup errno
[oweals/gnunet.git]
/
src
/
transport
/
transport_api.c
diff --git
a/src/transport/transport_api.c
b/src/transport/transport_api.c
index 3a5c8e0f5b3c3bf524ed8226759fa1385991e558..8d08f82d9d3f516796604a662dcc9b977b3992af 100644
(file)
--- a/
src/transport/transport_api.c
+++ b/
src/transport/transport_api.c
@@
-203,7
+203,7
@@
struct GNUNET_TRANSPORT_TransmitHandle
* Function to call when notify_size bytes are available
* for transmission.
*/
* Function to call when notify_size bytes are available
* for transmission.
*/
- GNUNET_
NETWORK
_TransmitReadyNotify notify;
+ GNUNET_
CONNECTION
_TransmitReadyNotify notify;
/**
* Closure for notify.
/**
* Closure for notify.
@@
-278,7
+278,7
@@
struct GNUNET_TRANSPORT_Handle
/**
* Handle to our registration with the client for notification.
*/
/**
* Handle to our registration with the client for notification.
*/
- struct GNUNET_
NETWORK
_TransmitHandle *network_handle;
+ struct GNUNET_
CONNECTION
_TransmitHandle *network_handle;
/**
* Linked list of transmit handles that are waiting for the
/**
* Linked list of transmit handles that are waiting for the
@@
-390,8
+390,15
@@
transport_notify_ready (void *cls, size_t size, void *buf)
GNUNET_assert (n->transmit_handle == th);
n->transmit_handle = NULL;
}
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);
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
return 0;
}
#if DEBUG_TRANSPORT
@@
-407,8
+414,6
@@
transport_notify_ready (void *cls, size_t size, void *buf)
th = h->connect_ready_head;
if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK)
{
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;
GNUNET_SCHEDULER_cancel (h->sched,
th->notify_delay_task);
th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK;
@@
-569,7
+574,7
@@
try_connect (struct GNUNET_TRANSPORT_TransmitHandle *th);
* TransmitHandle.
*/
static void
* 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;
{
struct GNUNET_TRANSPORT_TransmitHandle *th = cls;
@@
-605,7
+610,7
@@
schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h,
size_t size,
int at_head,
struct GNUNET_TIME_Relative timeout,
size_t size,
int at_head,
struct GNUNET_TIME_Relative timeout,
- GNUNET_
NETWORK
_TransmitReadyNotify notify,
+ GNUNET_
CONNECTION
_TransmitReadyNotify notify,
void *notify_cls)
{
struct GNUNET_TRANSPORT_TransmitHandle *th;
void *notify_cls)
{
struct GNUNET_TRANSPORT_TransmitHandle *th;
@@
-622,7
+627,7
@@
schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h,
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
timeout,
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;
if (at_head)
{
th->next = h->connect_ready_head;
@@
-989,6
+994,11
@@
request_connect (void *cls, size_t size, void *buf)
"TRY_CONNECT",
GNUNET_i2s(&th->target));
#endif
"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;
th->notify (th->notify_cls, 0, NULL);
GNUNET_free (th);
return 0;
@@
-1011,7
+1021,7
@@
request_connect (void *cls, size_t size, void *buf)
GNUNET_SCHEDULER_NO_TASK,
GNUNET_TIME_absolute_get_remaining
(th->timeout),
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);
}
insert_transmit_handle (&h->connect_wait_head, th);
return sizeof (struct TryConnectMessage);
}
@@
-1104,10
+1114,14
@@
remove_neighbour (struct GNUNET_TRANSPORT_Handle *h,
{
/* signal error */
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == th->notify_delay_task);
{
/* signal error */
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == th->notify_delay_task);
- transmit_timeout (th, NULL);
+ peer_transmit_timeout (th, NULL);
}
else
{
}
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
/* try again in a bit */
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == th->notify_delay_task);
th->notify_delay_task
@@
-1136,6
+1150,9
@@
reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
struct GNUNET_TRANSPORT_TransmitHandle *pos;
struct NeighbourList *n;
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))
/* Forget about all neighbours that we used to be connected
to */
while (NULL != (n = h->neighbours))
@@
-1322,7
+1339,7
@@
schedule_request (struct GNUNET_TRANSPORT_TransmitHandle *th)
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
GNUNET_TIME_absolute_get_remaining
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;
return;
}
n->transmit_ok = GNUNET_NO;
@@
-1484,11
+1501,13
@@
GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle)
struct GNUNET_CLIENT_Connection *client;
#if DEBUG_TRANSPORT
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;
#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);
}
th->notify (th->notify_cls, 0, NULL);
GNUNET_free (th);
}
@@
-1573,7
+1592,7
@@
demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
#endif
if (h->network_handle != NULL)
{
#endif
if (h->network_handle != NULL)
{
- GNUNET_
NETWORK
_notify_transmit_ready_cancel (h->network_handle);
+ GNUNET_
CONNECTION
_notify_transmit_ready_cancel (h->network_handle);
h->network_handle = NULL;
h->transmission_scheduled = GNUNET_NO;
th = h->connect_ready_head;
h->network_handle = NULL;
h->transmission_scheduled = GNUNET_NO;
th = h->connect_ready_head;
@@
-1585,7
+1604,7
@@
demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
GNUNET_TIME_absolute_get_remaining(th->timeout),
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);
th);
}
GNUNET_CLIENT_disconnect (h->client);
@@
-1768,7
+1787,7
@@
demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
struct ClientTransmitWrapper
{
struct ClientTransmitWrapper
{
- GNUNET_
NETWORK
_TransmitReadyNotify notify;
+ GNUNET_
CONNECTION
_TransmitReadyNotify notify;
void *notify_cls;
struct GNUNET_TRANSPORT_TransmitHandle *th;
};
void *notify_cls;
struct GNUNET_TRANSPORT_TransmitHandle *th;
};
@@
-1856,7
+1875,7
@@
GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle
*target, size_t size,
unsigned int priority,
struct GNUNET_TIME_Relative timeout,
*target, size_t size,
unsigned int priority,
struct GNUNET_TIME_Relative timeout,
- GNUNET_
NETWORK
_TransmitReadyNotify
+ GNUNET_
CONNECTION
_TransmitReadyNotify
notify, void *notify_cls)
{
struct GNUNET_TRANSPORT_TransmitHandle *pos;
notify, void *notify_cls)
{
struct GNUNET_TRANSPORT_TransmitHandle *pos;
@@
-1928,7
+1947,7
@@
GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle
GNUNET_NO,
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
GNUNET_NO,
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
- timeout, &transmit_timeout, th);
+ timeout, &
peer_
transmit_timeout, th);
return th;
}
return th;
}
@@
-1943,8
+1962,7
@@
GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle
/**
/**
- * Cancel the specified transmission-ready
- * notification.
+ * Cancel the specified transmission-ready notification.
*/
void
GNUNET_TRANSPORT_notify_transmit_ready_cancel (struct
*/
void
GNUNET_TRANSPORT_notify_transmit_ready_cancel (struct
@@
-1964,11
+1982,12
@@
GNUNET_TRANSPORT_notify_transmit_ready_cancel (struct
h = th->handle;
if ((h->connect_ready_head == NULL) && (h->network_handle != NULL))
{
h = th->handle;
if ((h->connect_ready_head == NULL) && (h->network_handle != NULL))
{
- GNUNET_
NETWORK
_notify_transmit_ready_cancel (h->network_handle);
+ GNUNET_
CONNECTION
_notify_transmit_ready_cancel (h->network_handle);
h->network_handle = NULL;
h->transmission_scheduled = GNUNET_NO;
}
GNUNET_free (th->notify_cls);
h->network_handle = NULL;
h->transmission_scheduled = GNUNET_NO;
}
GNUNET_free (th->notify_cls);
+ GNUNET_assert (th->notify_delay_task == GNUNET_SCHEDULER_NO_TASK);
GNUNET_free (th);
}
GNUNET_free (th);
}