return ret;
case GNUNET_MESSAGE_TYPE_TRANSPORT_PING:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Processing `%s' from `%s'\n", "PING",
+ "Processing PING from `%s'\n",
GST_plugins_a2s (address));
if (GNUNET_OK !=
GST_validation_handle_ping (&address->peer,
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_PONG:
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Processing `%s' from `%s'\n", "PONG",
+ "Processing PONG from `%s'\n",
GST_plugins_a2s (address));
if (GNUNET_OK != GST_validation_handle_pong (&address->peer, message))
{
}
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT:
- GST_neighbours_handle_disconnect_message (&address->peer, message);
+ GST_neighbours_handle_disconnect_message (&address->peer,
+ message);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE:
- GST_neighbours_keepalive (&address->peer, message);
+ GST_neighbours_keepalive (&address->peer,
+ message);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE:
- GST_neighbours_keepalive_response (&address->peer, message);
+ GST_neighbours_keepalive_response (&address->peer,
+ message);
break;
default:
/* should be payload */
message);
break;
}
- end:
+ end:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Allowing receive from peer %s to continue in %s\n",
GNUNET_i2s (&address->peer),
GNUNET_YES,
NULL, NULL);
GNUNET_STATISTICS_update (GST_stats,
- gettext_noop ("# keepalives sent"),
+ gettext_noop ("# KEEPALIVES sent"),
1,
GNUNET_NO);
n->primary_address.keep_alive_nonce = nonce;
struct SessionKeepAliveMessage msg;
if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size))
+ {
+ GNUNET_break_op (0);
return;
+ }
- msg_in = (struct SessionKeepAliveMessage *) m;
+ msg_in = (const struct SessionKeepAliveMessage *) m;
if (NULL == (n = lookup_neighbour (neighbour)))
{
GNUNET_STATISTICS_update (GST_stats,
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received keep alive request from peer `%s' with nonce %u\n",
- GNUNET_i2s (&n->id), ntohl (msg_in->nonce));
+ "Received KEEPALIVE request from peer `%s' with nonce %u\n",
+ GNUNET_i2s (&n->id),
+ ntohl (msg_in->nonce));
/* send reply to allow neighbour to measure latency */
msg.header.size = htons (sizeof (struct SessionKeepAliveMessage));
struct GNUNET_TIME_Relative latency;
if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size))
+ {
+ GNUNET_break_op (0);
return;
+ }
msg = (const struct SessionKeepAliveMessage *) m;
if (NULL == (n = lookup_neighbour (neighbour)))
{
GNUNET_STATISTICS_update (GST_stats,
- gettext_noop
- ("# KEEPALIVE_RESPONSE messages discarded (not connected)"),
- 1, GNUNET_NO);
+ gettext_noop ("# KEEPALIVE_RESPONSE messages discarded (not connected)"),
+ 1,
+ GNUNET_NO);
return;
}
if ( (GNUNET_TRANSPORT_PS_CONNECTED != n->state) ||
(GNUNET_YES != n->expect_latency_response) )
{
GNUNET_STATISTICS_update (GST_stats,
- gettext_noop
- ("# KEEPALIVE_RESPONSE messages discarded (not expected)"),
- 1, GNUNET_NO);
+ gettext_noop ("# KEEPALIVE_RESPONSE messages discarded (not expected)"),
+ 1,
+ GNUNET_NO);
return;
}
if (NULL == n->primary_address.address)
{
GNUNET_STATISTICS_update (GST_stats,
- gettext_noop
- ("# KEEPALIVE_RESPONSE messages discarded (address changed)"),
- 1, GNUNET_NO);
+ gettext_noop ("# KEEPALIVE_RESPONSE messages discarded (address changed)"),
+ 1,
+ GNUNET_NO);
return;
}
if (n->primary_address.keep_alive_nonce != ntohl (msg->nonce))
{
GNUNET_STATISTICS_update (GST_stats,
- gettext_noop
- ("# KEEPALIVE_RESPONSE messages discarded (wrong nonce)"),
- 1, GNUNET_NO);
+ gettext_noop ("# KEEPALIVE_RESPONSE messages discarded (wrong nonce)"),
+ 1,
+ GNUNET_NO);
return;
}
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received keep alive response from peer `%s' for session %p\n",
- GNUNET_i2s (&n->id),
- n->primary_address.session);
+ GNUNET_STATISTICS_update (GST_stats,
+ gettext_noop ("# KEEPALIVE_RESPONSE messages received in good order"),
+ 1,
+ GNUNET_NO);
- }
/* Update session timeout here */
if (NULL != (papi = GST_plugins_find (n->primary_address.address->transport_name)))
latency = GNUNET_TIME_absolute_get_duration (n->last_keep_alive_time);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Latency for peer `%s' is %s\n",
+ "Received KEEPALIVE_RESPONSE from peer `%s', latency is %s\n",
GNUNET_i2s (&n->id),
GNUNET_STRINGS_relative_time_to_string (latency,
GNUNET_YES));
GST_ats_update_delay (n->primary_address.address,
- GNUNET_TIME_relative_divide (latency, 2));
+ GNUNET_TIME_relative_divide (latency,
+ 2));
}
ve->valid_until = GNUNET_TIME_UNIT_ZERO_ABS;
/* Notify about deleted entry */
- validation_entry_changed (ve, GNUNET_TRANSPORT_VS_REMOVE);
+ validation_entry_changed (ve,
+ GNUNET_TRANSPORT_VS_REMOVE);
if (NULL != ve->bc)
{
gettext_noop ("# validations running"),
validations_running,
GNUNET_NO);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Validation aborted, %u validation processes running\n",
- validations_running);
}
GNUNET_free (ve);
return GNUNET_OK;
struct GNUNET_TIME_Relative left;
ve->timeout_task = NULL;
+ /* For valid addresses, we want to wait until the expire;
+ for addresses under PING validation, we want to wait
+ until we give up on the PING */
max = GNUNET_TIME_absolute_max (ve->valid_until,
ve->revalidation_block);
- left = GNUNET_TIME_absolute_get_remaining (max);
+ left = GNUNET_TIME_absolute_get_remaining (ve->max);
if (left.rel_value_us > 0)
{
- /* should wait a bit longer */
+ /* We should wait a bit longer. This happens when
+ address lifetimes are extended due to successful
+ validations. */
ve->timeout_task =
- GNUNET_SCHEDULER_add_delayed (left, &timeout_hello_validation, ve);
+ GNUNET_SCHEDULER_add_delayed (left,
+ &timeout_hello_validation,
+ ve);
return;
}
GNUNET_STATISTICS_update (GST_stats,
- gettext_noop ("# address records discarded"), 1,
+ gettext_noop ("# address records discarded (timeout)"),
+ 1,
GNUNET_NO);
- cleanup_validation_entry (NULL, &ve->address->peer, ve);
+ cleanup_validation_entry (NULL,
+ &ve->address->peer,
+ ve);
}
if (GNUNET_NO == result)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Blacklist denies to send PING to `%s' `%s' `%s'\n",
+ "Blacklist denies sending PING to `%s' `%s' `%s'\n",
GNUNET_i2s (pid),
GST_plugins_a2s (ve->address),
ve->address->transport_name);
- cleanup_validation_entry (NULL, pid, ve);
+ GNUNET_STATISTICS_update (GST_stats,
+ gettext_noop ("# address records discarded (blacklist)"),
+ 1,
+ GNUNET_NO);
+ cleanup_validation_entry (NULL,
+ pid,
+ ve);
return;
}
hello = GST_hello_get ();
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
ve->timeout_task =
GNUNET_SCHEDULER_add_delayed (UNVALIDATED_PING_KEEPALIVE,
- &timeout_hello_validation, ve);
- GNUNET_CONTAINER_multipeermap_put (validation_map, &address->peer,
+ &timeout_hello_validation,
+ ve);
+ GNUNET_CONTAINER_multipeermap_put (validation_map,
+ &address->peer,
ve,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
publish_ve_stat_update ();