*/
static int monitor_connections;
+/**
+ * Option -f.
+ */
+static int monitor_validation;
+
/**
* Option -C.
*/
s_next = GNUNET_strdup(GNUNET_STRINGS_absolute_time_to_string (vc->next_validation));
FPRINTF (stdout,
- _("Peer `%s' %s `%s'\n\t%s%s\n\t%s%s\n\t%s%s\n"),
- GNUNET_i2s (&vc->id), address, GNUNET_TRANSPORT_vs2s (vc->state),
+ _("Peer `%s' %s %s\n\t%s%s\n\t%s%s\n\t%s%s\n"),
+ GNUNET_i2s (&vc->id), address,
+ (monitor_validation) ? GNUNET_TRANSPORT_vs2s (vc->state) : "",
"Valid until : ", s_valid,
"Last validation: ",s_last,
"Next validation: ", s_next);
}
counter = benchmark_send + benchmark_receive + iterate_connections
- + monitor_connections + monitor_connects + try_connect + iterate_validation;
+ + monitor_connections + monitor_connects + try_connect
+ + iterate_validation + monitor_validation;
if (1 < counter)
{
}
else if (iterate_validation) /* -d: Print information about validations */
{
- vic = GNUNET_TRANSPORT_monitor_validation_entries (cfg, (NULL == cpid) ? NULL : &pid,
+ vic = GNUNET_TRANSPORT_monitor_validation_entries (cfg,
+ (NULL == cpid) ? NULL : &pid,
GNUNET_YES, TIMEOUT, &process_validation_cb, (void *) cfg);
}
+ else if (monitor_validation) /* -f: Print information about validations continuously */
+ {
+ vic = GNUNET_TRANSPORT_monitor_validation_entries (cfg,
+ (NULL == cpid) ? NULL : &pid,
+ GNUNET_NO, TIMEOUT, &process_validation_cb, (void *) cfg);
+ }
else if (monitor_connects) /* -e : Monitor (dis)connect events continuously */
{
monitor_connect_counter = 0;
{ 'd', "validation", NULL,
gettext_noop ("print information for all pending validations "),
0, &GNUNET_GETOPT_set_one, &iterate_validation },
+ { 'f', "monitorvalidation", NULL,
+ gettext_noop ("print information for all pending validations continously"),
+ 0, &GNUNET_GETOPT_set_one, &monitor_validation },
{ 'i', "information", NULL,
gettext_noop ("provide information about all current connections (once)"),
0, &GNUNET_GETOPT_set_one, &iterate_connections },
{
switch (state)
{
+ case GNUNET_TRANSPORT_VS_NONE:
+ return "NEW";
case GNUNET_TRANSPORT_VS_NEW:
return "NEW";
case GNUNET_TRANSPORT_VS_REMOVE:
{
struct ValidationMonitorMessage msg;
- msg.header.size = htons (sizeof (struct PeerMonitorMessage));
+ msg.header.size = htons (sizeof (struct ValidationMonitorMessage));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_REQUEST);
msg.one_shot = htonl (val_ctx->one_shot);
msg.peer = val_ctx->peer;
val_ctx));
}
-
/**
* Task run to re-establish the connection.
*
* @param tc scheduler context, unused
*/
static void
-do_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_peer_connect (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls;
pal_ctx->client = NULL;
pal_ctx->backoff = GNUNET_TIME_STD_BACKOFF (pal_ctx->backoff);
pal_ctx->reconnect_task = GNUNET_SCHEDULER_add_delayed (pal_ctx->backoff,
- &do_connect,
+ &do_peer_connect,
pal_ctx);
}
+
+/**
+ * Task run to re-establish the connection.
+ *
+ * @param cls our 'struct GNUNET_TRANSPORT_PeerAddressLookupContext*'
+ * @param tc scheduler context, unused
+ */
+static void
+do_val_connect (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct GNUNET_TRANSPORT_ValidationMonitoringContext *val_ctx = cls;
+
+ val_ctx->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
+ val_ctx->client = GNUNET_CLIENT_connect ("transport", val_ctx->cfg);
+ GNUNET_assert (NULL != val_ctx->client);
+ send_val_mon_request (val_ctx);
+}
+
/**
* Cut the existing connection and reconnect.
*
val_ctx->client = NULL;
val_ctx->backoff = GNUNET_TIME_STD_BACKOFF (val_ctx->backoff);
val_ctx->reconnect_task = GNUNET_SCHEDULER_add_delayed (val_ctx->backoff,
- &do_connect,
+ &do_val_connect,
val_ctx);
}
if (msg == NULL)
{
- GNUNET_break (0);
if (val_ctx->one_shot)
{
/* Disconnect */
size = ntohs (msg->size);
GNUNET_break (ntohs (msg->type) ==
GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_RESPONSE);
+
if (size == sizeof (struct GNUNET_MessageHeader))
{
/* Done! */
uint16_t size;
size_t alen;
size_t tlen;
- GNUNET_break (0);
+
if (msg == NULL)
{
if (pal_ctx->one_shot)