static int
map_check_it (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
int *fail = cls;
static int
map_cleanup_it (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct PeerContainer *pc = value;
int map_ping_it (void *cls,
- const GNUNET_HashCode * key,
+ const struct GNUNET_HashCode * key,
void *value)
{
struct PeerContainer *pc = value;
if ((GNUNET_YES == pc->transport_connected) && (NULL == pc->th_ping))
pc->th_ping = GNUNET_TRANSPORT_notify_transmit_ready(th, &pc->id,
sizeof (struct PING), UINT_MAX,
- GNUNET_TIME_relative_get_forever(), &send_transport_ping_cb, pc);
+ GNUNET_TIME_UNIT_FOREVER_REL, &send_transport_ping_cb, pc);
else
GNUNET_break(0);
if ((GNUNET_YES == pc->core_connected) && (NULL == pc->ch_ping))
pc->ch_ping = GNUNET_CORE_notify_transmit_ready(ch,
GNUNET_NO, UINT_MAX,
- GNUNET_TIME_relative_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_REL,
&pc->id,
sizeof (struct PING),
send_core_ping_cb, pc);
}
pc = GNUNET_CONTAINER_multihashmap_get(peers, &peer->hashPubKey);
+ GNUNET_assert (NULL != pc);
+
if (source == th)
{
if (GNUNET_NO == pc->transport_connected)
if (GNUNET_YES == ping)
{
if (NULL == pc->th_ping)
- pc->th_ping = GNUNET_TRANSPORT_notify_transmit_ready(th, peer, sizeof (struct PING), UINT_MAX, GNUNET_TIME_relative_get_forever(), &send_transport_ping_cb, pc);
+ pc->th_ping = GNUNET_TRANSPORT_notify_transmit_ready(th, peer, sizeof (struct PING), UINT_MAX, GNUNET_TIME_UNIT_FOREVER_REL, &send_transport_ping_cb, pc);
else
GNUNET_break(0);
}
if (NULL == pc->ch_ping)
pc->ch_ping = GNUNET_CORE_notify_transmit_ready(ch,
GNUNET_NO, UINT_MAX,
- GNUNET_TIME_relative_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_REL,
peer,
sizeof (struct PING),
send_core_ping_cb, pc);
}
pc = GNUNET_CONTAINER_multihashmap_get(peers, &peer->hashPubKey);
+ GNUNET_assert (NULL != pc);
+
if (source == th)
{
if (NULL != pc->th_ping)
if (NULL == pc->th_pong)
pc->th_pong = GNUNET_TRANSPORT_notify_transmit_ready(th,
peer, sizeof (struct PONG),
- UINT_MAX, GNUNET_TIME_relative_get_forever(),
+ UINT_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
&send_transport_pong_cb, pc);
else
GNUNET_break (0);
if (NULL == pc->ch_pong)
pc->ch_pong = GNUNET_CORE_notify_transmit_ready(ch,
GNUNET_NO, UINT_MAX,
- GNUNET_TIME_relative_get_forever(),
+ GNUNET_TIME_UNIT_FOREVER_REL,
peer,
sizeof (struct PONG),
send_core_pong_cb, pc);
init();
stats = GNUNET_STATISTICS_create ("watchdog", cfg);
- peers = GNUNET_CONTAINER_multihashmap_create (20);
+ peers = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO);
th = GNUNET_TRANSPORT_connect(cfg, NULL, NULL,
&transport_notify_receive_cb,
&transport_notify_disconnect_cb);
GNUNET_assert (th != NULL);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connected to transport service\n");
- ch = GNUNET_CORE_connect (cfg, 1, NULL,
+ ch = GNUNET_CORE_connect (cfg, NULL,
&core_init_cb,
&core_connect_cb,
&core_disconnect_cb,
GNUNET_NO, &GNUNET_GETOPT_set_one, &ping},
GNUNET_GETOPT_OPTION_END
};
- return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "cn",
- gettext_noop ("help text"), options, &run,
- NULL)) ? ret : 1;
+
+ if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+ return 2;
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (argc, argv, "cn",
+ gettext_noop ("help text"), options, &run,
+ NULL)) ? ret : 1;
+ GNUNET_free ((void*) argv);
+ return ret;
}
/* end of connection_watchdog.c */