if (size < sizeof (struct ConnectInfoMessage))
{
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
cim = (const struct ConnectInfoMessage *) msg;
sizeof (struct ConnectInfoMessage))
{
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
if (NULL != n)
{
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
n = neighbour_add (h,
if (size != sizeof (struct DisconnectInfoMessage))
{
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
dim = (const struct DisconnectInfoMessage *) msg;
if (NULL == n)
{
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
neighbour_delete (h,
if (size != sizeof (struct SendOkMessage))
{
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
okm = (const struct SendOkMessage *) msg;
&okm->peer);
if (NULL == n)
{
- /* we should never get a 'SEND_OK' for a peer that we are not
+ /* We should never get a 'SEND_OK' for a peer that we are not
connected to */
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
if (bytes_physical >= bytes_msg)
}
GNUNET_break (GNUNET_NO == n->is_ready);
n->is_ready = GNUNET_YES;
- GNUNET_SCHEDULER_cancel (n->unready_warn_task);
- n->unready_warn_task = NULL;
+ if (NULL != n->unready_warn_task)
+ {
+ GNUNET_SCHEDULER_cancel (n->unready_warn_task);
+ n->unready_warn_task = NULL;
+ }
if ((NULL != n->th) && (NULL == n->hn))
{
GNUNET_assert (NULL != n->th->timeout_task);
sizeof (struct InboundMessage) + sizeof (struct GNUNET_MessageHeader))
{
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
im = (const struct InboundMessage *) msg;
if (ntohs (imm->size) + sizeof (struct InboundMessage) != size)
{
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
if (NULL == n)
{
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
if (NULL != h->rec)
if (size != sizeof (struct QuotaSetMessage))
{
GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
}
qm = (const struct QuotaSetMessage *) msg;
n = neighbour_find (h, &qm->peer);
if (NULL == n)
+ {
+ GNUNET_break (0);
+ h->reconnecting = GNUNET_YES;
+ disconnect_and_schedule_reconnect (h);
break;
+ }
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Receiving SET_QUOTA message for `%s' with quota %u\n",
GNUNET_i2s (&qm->peer),
size,
&cbuf[ret]);
delay = GNUNET_TIME_absolute_get_duration (th->request_start);
- if (delay.rel_value_us > 1000 * 1000)
+ if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
LOG (GNUNET_ERROR_TYPE_WARNING,
"Added %u bytes of control message at %u after %s delay\n",
nret,
GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap));
n->hn = NULL;
n->th = NULL;
- n->is_ready = GNUNET_NO; // FIXME! move into 'if' below!
GNUNET_assert (size >= sizeof (struct OutboundMessage));
- mret =
- th->notify (th->notify_cls, size - sizeof (struct OutboundMessage),
- &cbuf[ret + sizeof (struct OutboundMessage)]);
+ mret = th->notify (th->notify_cls,
+ size - sizeof (struct OutboundMessage),
+ &cbuf[ret + sizeof (struct OutboundMessage)]);
GNUNET_assert (mret <= size - sizeof (struct OutboundMessage));
- if (0 != mret)
+ if (0 == mret)
{
- if (NULL != n->unready_warn_task)
- n->unready_warn_task
- = GNUNET_SCHEDULER_add_delayed (UNREADY_WARN_TIME,
- &do_warn_unready,
- n);
- n->last_payload = GNUNET_TIME_absolute_get ();
- GNUNET_assert (mret + sizeof (struct OutboundMessage) <
- GNUNET_SERVER_MAX_MESSAGE_SIZE);
- obm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND);
- obm.header.size = htons (mret + sizeof (struct OutboundMessage));
- obm.reserved = htonl (0);
- obm.timeout =
- GNUNET_TIME_relative_hton (GNUNET_TIME_absolute_get_remaining
- (th->timeout));
- obm.peer = n->id;
- memcpy (&cbuf[ret],
- &obm,
- sizeof (struct OutboundMessage));
- ret += (mret + sizeof (struct OutboundMessage));
- size -= (mret + sizeof (struct OutboundMessage));
- GNUNET_BANDWIDTH_tracker_consume (&n->out_tracker,
- mret);
- delay = GNUNET_TIME_absolute_get_duration (th->request_start);
- if (delay.rel_value_us > 1000 * 1000)
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Added %u bytes of payload message at %u after %s delay\n",
- mret,
- ret,
- GNUNET_STRINGS_relative_time_to_string (delay,
- GNUNET_YES));
- else
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Added %u bytes of payload message at %u after %s delay\n",
- mret,
- ret,
- GNUNET_STRINGS_relative_time_to_string (delay,
- GNUNET_YES));
+ GNUNET_free (th);
+ continue;
}
+ if (NULL != n->unready_warn_task)
+ n->unready_warn_task
+ = GNUNET_SCHEDULER_add_delayed (UNREADY_WARN_TIME,
+ &do_warn_unready,
+ n);
+ n->last_payload = GNUNET_TIME_absolute_get ();
+ n->is_ready = GNUNET_NO;
+ GNUNET_assert (mret + sizeof (struct OutboundMessage) <
+ GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ obm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND);
+ obm.header.size = htons (mret + sizeof (struct OutboundMessage));
+ obm.reserved = htonl (0);
+ obm.timeout =
+ GNUNET_TIME_relative_hton (GNUNET_TIME_absolute_get_remaining
+ (th->timeout));
+ obm.peer = n->id;
+ memcpy (&cbuf[ret],
+ &obm,
+ sizeof (struct OutboundMessage));
+ ret += (mret + sizeof (struct OutboundMessage));
+ size -= (mret + sizeof (struct OutboundMessage));
+ GNUNET_BANDWIDTH_tracker_consume (&n->out_tracker,
+ mret);
+ delay = GNUNET_TIME_absolute_get_duration (th->request_start);
+ if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "Added %u bytes of payload message for %s after %s delay at %u b/s\n",
+ mret,
+ GNUNET_i2s (&n->id),
+ GNUNET_STRINGS_relative_time_to_string (delay,
+ GNUNET_YES),
+ (unsigned int) n->out_tracker.available_bytes_per_s__);
+ else
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Added %u bytes of payload message for %s after %s delay at %u b/s\n",
+ mret,
+ GNUNET_i2s (&n->id),
+ GNUNET_STRINGS_relative_time_to_string (delay,
+ GNUNET_YES),
+ (unsigned int) n->out_tracker.available_bytes_per_s__);
GNUNET_free (th);
+ break;
}
/* if there are more pending messages, try to schedule those */
schedule_transmission (h);
{
struct GNUNET_TRANSPORT_TransmitHandle *th;
- GNUNET_assert (h->reconnect_task == NULL);
+ GNUNET_assert (NULL == h->reconnect_task);
if (NULL != h->cth)
{
GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth);
* @param cont continuation to call when HELLO has been sent,
* tc reason #GNUNET_SCHEDULER_REASON_TIMEOUT for fail
* tc reasong #GNUNET_SCHEDULER_REASON_READ_READY for success
- * @param cls closure for continuation
+ * @param cont_cls closure for @a cont
* @return a `struct GNUNET_TRANSPORT_OfferHelloHandle` handle or NULL on failure,
- * in case of failure cont will not be called
+ * in case of failure @a cont will not be called
*
*/
struct GNUNET_TRANSPORT_OfferHelloHandle *
GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle,
const struct GNUNET_MessageHeader *hello,
GNUNET_SCHEDULER_TaskCallback cont,
- void *cls)
+ void *cont_cls)
{
struct GNUNET_TRANSPORT_OfferHelloHandle *ohh;
struct GNUNET_MessageHeader *msg;
ohh = GNUNET_new (struct GNUNET_TRANSPORT_OfferHelloHandle);
ohh->th = handle;
ohh->cont = cont;
- ohh->cls = cls;
+ ohh->cls = cont_cls;
ohh->msg = msg;
- ohh->tth = schedule_control_transmit (handle, size,
- &send_hello, ohh);
- GNUNET_CONTAINER_DLL_insert (handle->oh_head, handle->oh_tail, ohh);
+ ohh->tth = schedule_control_transmit (handle,
+ size,
+ &send_hello,
+ ohh);
+ GNUNET_CONTAINER_DLL_insert (handle->oh_head,
+ handle->oh_tail,
+ ohh);
return ohh;
}
n->traffic_overhead = 0;
if (delay.rel_value_us > timeout.rel_value_us)
delay.rel_value_us = 0; /* notify immediately (with failure) */
- if (delay.rel_value_us > GNUNET_TIME_UNIT_SECONDS.rel_value_us)
+ if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
LOG (GNUNET_ERROR_TYPE_WARNING,
"At bandwidth %u byte/s next transmission to %s in %s\n",
(unsigned int) n->out_tracker.available_bytes_per_s__,