GNUNET_break (0);
return;
}
- GML_send_nack (ch->root, ch->lid_root);
+ GML_send_channel_nack (ch->root, ch->lid_root);
}
rel = copy->rel;
if (GNUNET_SCHEDULER_NO_TASK == rel->retry_task)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "!! scheduling retry in %s\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!! scheduling retry in 4 * %s\n",
GNUNET_STRINGS_relative_time_to_string (rel->expected_delay,
GNUNET_YES));
if (0 != rel->expected_delay.rel_value_us)
rel->uniq = NULL;
if (MESH_CHANNEL_READY != rel->ch->state
- && GNUNET_MESSAGE_TYPE_MESH_DATA_ACK != type)
+ && GNUNET_MESSAGE_TYPE_MESH_DATA_ACK != type
+ && GNUNET_NO == rel->ch->destroy)
{
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rel->retry_task);
LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! STD BACKOFF %s\n",
struct MeshChannel *ch,
int force)
{
- GNUNET_break (NULL == GMT_send_prebuilt_message (msg, ch->t, force,
- NULL, NULL));
+ GNUNET_break (NULL == GMT_send_prebuilt_message (msg, ch->t, NULL,
+ force, NULL, NULL));
}
target = mid + i + 1;
LOG (GNUNET_ERROR_TYPE_DEBUG, " target %u\n", target);
while (NULL != copy && GM_is_pid_bigger (target, copy->mid))
- copy = copy->next;
+ copy = copy->next;
/* Did we run out of copies? (previously freed, it's ok) */
if (NULL == copy)
rel->expected_delay.rel_value_us += time.rel_value_us;
rel->expected_delay.rel_value_us /= 8;
}
- LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! took %s\n",
- GNUNET_STRINGS_relative_time_to_string (time, GNUNET_NO));
- LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! new expected delay %s\n",
- GNUNET_STRINGS_relative_time_to_string (rel->expected_delay,
- GNUNET_NO));
+ LOG (GNUNET_ERROR_TYPE_INFO, "!!! took %s, new delay %s\n",
+ GNUNET_STRINGS_relative_time_to_string (time, GNUNET_NO),
+ GNUNET_STRINGS_relative_time_to_string (rel->expected_delay,
+ GNUNET_NO));
rel->retry_timer = rel->expected_delay;
}
else
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! batch free, ignoring timing\n");
+ LOG (GNUNET_ERROR_TYPE_INFO, "!!! batch free, ignoring timing\n");
}
rel->ch->pending_messages--;
if (NULL != copy->chq)
oldstate = ch->state;
ch->state = MESH_CHANNEL_READY;
- rel->client_ready = GNUNET_YES;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- " !! retry timer confirm %s\n",
- GNUNET_STRINGS_relative_time_to_string (rel->retry_timer, GNUNET_NO));
- rel->expected_delay = rel->retry_timer;
- if (GMT_get_connections_buffer (ch->t) > 0 || GMT_is_loopback (ch->t))
- send_client_ack (ch, fwd);
-
- if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task)
- {
- GNUNET_SCHEDULER_cancel (rel->retry_task);
- rel->retry_task = GNUNET_SCHEDULER_NO_TASK;
- }
- else if (NULL != rel->uniq)
- {
- GMT_cancel (rel->uniq->tq);
- /* ch_message_sent will free and NULL uniq */
- }
- else
+ if (MESH_CHANNEL_READY != oldstate || GNUNET_YES == is_loopback (ch))
{
- if (GNUNET_NO == is_loopback (ch))
+ rel->client_ready = GNUNET_YES;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " !! retry timer confirm %s\n",
+ GNUNET_STRINGS_relative_time_to_string (rel->retry_timer, GNUNET_NO));
+ rel->expected_delay = rel->retry_timer;
+ if (GMT_get_connections_buffer (ch->t) > 0 || GMT_is_loopback (ch->t))
+ send_client_ack (ch, fwd);
+
+ if (GNUNET_SCHEDULER_NO_TASK != rel->retry_task)
{
- /* We SHOULD have been trying to retransmit this! */
- GNUNET_break (oldstate == MESH_CHANNEL_READY);
+ GNUNET_SCHEDULER_cancel (rel->retry_task);
+ rel->retry_task = GNUNET_SCHEDULER_NO_TASK;
+ }
+ else if (NULL != rel->uniq)
+ {
+ GMT_cancel (rel->uniq->tq);
+ /* ch_message_sent will free and NULL uniq */
+ }
+ else
+ {
+ if (GNUNET_NO == is_loopback (ch))
+ {
+ /* We SHOULD have been trying to retransmit this! */
+ GNUNET_break (0);
+ }
}
}
{
case GNUNET_MESSAGE_TYPE_MESH_DATA:
/* Don't send hop ACK, wait for client to ACK */
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! SEND loopback %u (%u)\n",
+ ntohl (((struct GNUNET_MESH_Data *) msgh)->mid), ntohs (msgh->size));
GMCH_handle_data (ch, (struct GNUNET_MESH_Data *) msgh, fwd);
break;
/**
- * Get channel ID.
+ * Get the channel's public ID.
*
* @param ch Channel.
*
- * @return ID
+ * @return ID used to identify the channel with the remote peer.
*/
MESH_ChannelNumber
GMCH_get_id (const struct MeshChannel *ch)
}
rel = fwd ? ch->dest_rel : ch->root_rel;
ack = rel->mid_recv - 1;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- " !! Send DATA_ACK for %u\n",
- ack);
+ LOG (GNUNET_ERROR_TYPE_INFO, "=> DATA_ACK for %u\n", ack);
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA_ACK);
msg.header.size = htons (sizeof (msg));
if (NULL == c)
{
- GNUNET_break (0);
+ GNUNET_break (GNUNET_NO != ch->destroy);
return;
}
( !GM_is_pid_bigger (rel->mid_recv, mid) &&
GM_is_pid_bigger (rel->mid_recv + 64, mid) ) )
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! RECV %u\n", mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! RECV %u (%u)\n",
+ mid, ntohs (msg->header.size));
if (GNUNET_YES == ch->reliable)
{
/* Is this the exact next expected messasge? */
else
{
GNUNET_break_op (GM_is_pid_bigger (rel->mid_recv, mid));
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- " !!! MID %u not expected (%u - %u), dropping!\n",
- mid, rel->mid_recv, rel->mid_recv + 63);
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "MID %u not expected (%u - %u), dropping!\n",
+ mid, rel->mid_recv, rel->mid_recv + 63);
}
GMCH_send_data_ack (ch, fwd);
}
ack = ntohl (msg->mid);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! %s ACK %u\n",
- (GNUNET_YES == fwd) ? "FWD" : "BCK", ack);
+ LOG (GNUNET_ERROR_TYPE_INFO, "<= %s ACK %u\n", GM_f2s (fwd), ack);
if (GNUNET_YES == fwd)
{
}
if (NULL == rel)
{
- GNUNET_break_op (0);
+ GNUNET_break_op (GNUNET_NO != ch->destroy);
return;
}
- /* Free ACK'd copies: no need to retransmit those anymore */
+ /* Free ACK'd copies: no need to retransmit those anymore FIXME refactor */
for (work = GNUNET_NO, copy = rel->head_sent; copy != NULL; copy = next)
{
if (GM_is_pid_bigger (copy->mid, ack))
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! head %u, out!\n", copy->mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " head %u, out!\n", copy->mid);
channel_rel_free_sent (rel, msg);
break;
}
work = GNUNET_YES;
- LOG (GNUNET_ERROR_TYPE_DEBUG, " !! id %u\n", copy->mid);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " id %u\n", copy->mid);
next = copy->next;
if (GNUNET_YES == rel_message_free (copy, GNUNET_YES))
return;
}
- /* ACK client if needed */
+ /* ACK client if needed and possible */
GMCH_allow_client (ch, fwd);
/* If some message was free'd, update the retransmission delay */
rel);
}
}
- else /* work was done but no task was pending? shouldn't happen! */
+ else
{
+ /* Work was done but no task was pending? Shouldn't happen! */
GNUNET_break (0);
}
}
else
{
LOG (GNUNET_ERROR_TYPE_DEBUG, " duplicate create channel\n");
+ if (GNUNET_SCHEDULER_NO_TASK != ch->dest_rel->retry_task)
+ {
+ /* we were waiting to re-send our 'SYNACK', wait no more! */
+ GNUNET_SCHEDULER_cancel (ch->dest_rel->retry_task);
+ ch->dest_rel->retry_task = GNUNET_SCHEDULER_NO_TASK;
+ }
}
send_ack (ch, GNUNET_YES);
uint16_t type;
type = ntohs (message->type);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "GMCH Send %s %s on channel %s\n",
- GM_f2s (fwd), GM_m2s (type),
- GMCH_2s (ch));
+ LOG (GNUNET_ERROR_TYPE_INFO, "=> %s %s on channel %s\n",
+ GM_m2s (type), GM_f2s (fwd), GMCH_2s (ch));
if (GMT_is_loopback (ch->t))
{
switch (type)
{
+ struct GNUNET_MESH_Data *payload;
case GNUNET_MESSAGE_TYPE_MESH_DATA:
+ payload = (struct GNUNET_MESH_Data *) message;
+ LOG (GNUNET_ERROR_TYPE_INFO, "=> %s %u\n",
+ GM_m2s (type), ntohl(payload->mid));
if (GNUNET_YES == ch->reliable)
{
chq = GNUNET_new (struct MeshChannelQueue);
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " new chq: %p\n", chq);
chq->copy->chq = chq;
- chq->tq = GMT_send_prebuilt_message (message, ch->t,
- NULL != existing_copy,
- &ch_message_sent, chq);
+ chq->tq = GMT_send_prebuilt_message (message, ch->t, NULL,
+ NULL != existing_copy,
+ &ch_message_sent, chq);
/* q itself is stored in copy */
GNUNET_assert (NULL != chq->tq || GNUNET_NO != ch->destroy);
}
{
/* BCK ACK (going FWD) is just a response for a SYNACK, don't keep*/
fire_and_forget (message, ch, GNUNET_YES);
- break;
+ return;
}
/* fall-trough */
case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
GNUNET_free (chq->rel->uniq);
}
}
- chq->tq = GMT_send_prebuilt_message (message, ch->t, GNUNET_YES,
+ chq->tq = GMT_send_prebuilt_message (message, ch->t, NULL, GNUNET_YES,
&ch_message_sent, chq);
+ if (NULL == chq->tq)
+ {
+ GNUNET_break (0);
+ GNUNET_free (chq);
+ chq = NULL;
+ return;
+ }
chq->rel->uniq = chq;
break;