static void
-disconnect ()
+disconnected (void *cls)
+{
+ GNUNET_SCHEDULER_shutdown ();
+}
+
+
+static void
+app_disconnected (void *cls)
{
- if (hst)
+ if (hst || gst)
{
- GNUNET_SOCIAL_host_disconnect (hst, NULL, NULL);
+ if (hst)
+ {
+ GNUNET_SOCIAL_host_disconnect (hst, disconnected, NULL);
+ }
+ if (gst)
+ {
+ GNUNET_SOCIAL_guest_disconnect (gst, disconnected, NULL);
+ }
}
- if (gst)
+ else
{
- GNUNET_SOCIAL_guest_disconnect (gst, NULL, NULL);
+ GNUNET_SCHEDULER_shutdown ();
}
+}
+
- GNUNET_SOCIAL_app_disconnect (app);
+static void
+disconnect ()
+{
GNUNET_CORE_disconnect (core);
- GNUNET_SCHEDULER_shutdown ();
+ GNUNET_SOCIAL_app_disconnect (app, app_disconnected, NULL);
}
/**
GNUNET_SCHEDULER_cancel (timeout_task);
timeout_task = NULL;
}
- GNUNET_SCHEDULER_add_now (&schedule_success, NULL);
+ GNUNET_SCHEDULER_add_now (schedule_success, NULL);
}
GNUNET_SCHEDULER_cancel (timeout_task);
timeout_task = NULL;
}
- GNUNET_SCHEDULER_add_now (&schedule_fail, NULL);
+ GNUNET_SCHEDULER_add_now (schedule_fail, NULL);
}
static void
host_leave ()
{
- GNUNET_SOCIAL_host_leave (hst, NULL, &host_left, NULL);
+ GNUNET_SOCIAL_host_leave (hst, NULL, host_left, NULL);
hst = NULL;
plc = NULL;
}
// method in the middle of vars? FIXME
GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET,
"_notice_place_leave", DATA2ARG ("Leaving."));
- GNUNET_SOCIAL_guest_leave (gst, env, &guest_left, NULL);
+ GNUNET_SOCIAL_guest_leave (gst, env, guest_left, NULL);
GNUNET_PSYC_env_destroy (env);
gst = NULL;
plc = NULL;
{
exit_success ();
}
- return GNUNET_NO;
+ return GNUNET_YES;
}
else
{
- return GNUNET_YES;
+ return GNUNET_NO;
}
}
tmit.size = data_size;
GNUNET_SOCIAL_host_announce (hst, method, env,
- ¬ify_data, &tmit,
+ notify_data, &tmit,
GNUNET_SOCIAL_ANNOUNCE_NONE);
}
tmit.size = data_size;
GNUNET_SOCIAL_guest_talk (gst, method, env,
- ¬ify_data, &tmit,
+ notify_data, &tmit,
GNUNET_SOCIAL_TALK_NONE);
}
GNUNET_SOCIAL_place_history_replay (plc, start, end, prefix,
GNUNET_PSYC_HISTORY_REPLAY_LOCAL,
slicer,
- &recv_history_replay_result,
+ recv_history_replay_result,
NULL);
}
GNUNET_SOCIAL_place_history_replay_latest (plc, limit, prefix,
GNUNET_PSYC_HISTORY_REPLAY_LOCAL,
slicer,
- &recv_history_replay_result,
+ recv_history_replay_result,
NULL);
}
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
+ GNUNET_SIGNAL_handler_install (SIGINT, disconnect);
+ GNUNET_SIGNAL_handler_install (SIGTERM, disconnect);
+ GNUNET_SIGNAL_handler_install (SIGKILL, disconnect);
+
cfg = c;
if (!opt_method)
if (!opt_follow)
{
- timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &timeout, NULL);
+ timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, timeout, NULL);
}
if ((op_host_reconnect || op_host_leave || op_host_announce