* Cleans up.
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
shutdown_tid = NULL;
if (NULL != dht_op)
if HAVE_EXPERIMENTAL
EXP_DIR = \
dv \
- multicast \
- psycutil \
- psycstore \
- psyc \
rps \
- social \
$(CONSENSUS) \
- $(SECRETSHARING)
+ $(SECRETSHARING)
endif
if HAVE_REST
exit \
pt \
integration-tests \
+ multicast \
+ psycutil \
+ psycstore \
+ psyc \
+ social \
$(EXP_DIR) \
$(PROVIDER_DIR)
* Task scheduled to try to re-connect to arm.
*
* @param cls the 'struct GNUNET_ARM_Handle'
- * @param tc task context
*/
static void
-reconnect_arm_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_arm_task (void *cls)
{
struct GNUNET_ARM_Handle *h = cls;
* Message timed out. Remove it from the queue.
*
* @param cls the message (struct ARMControlMessage *)
- * @param tc task context
*/
static void
-control_message_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+control_message_timeout (void *cls)
{
struct ARMControlMessage *cm = cls;
struct GNUNET_ARM_Message *arm_msg;
struct GNUNET_SCHEDULER_Task * init_timeout_task_id;
};
+
static void
-monitor_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg);
+monitor_notify_handler (void *cls,
+ const struct GNUNET_MessageHeader *msg);
+
static int
reconnect_arm_monitor (struct GNUNET_ARM_MonitorHandle *h);
+
/**
* Task scheduled to try to re-connect to arm.
*
* @param cls the 'struct GNUNET_ARM_MonitorHandle'
- * @param tc task context
*/
static void
-reconnect_arm_monitor_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_arm_monitor_task (void *cls)
{
struct GNUNET_ARM_MonitorHandle *h = cls;
h->reconnect_task = NULL;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to ARM service for monitoring after delay\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Connecting to ARM service for monitoring after delay\n");
reconnect_arm_monitor (h);
}
* Init message timed out. Disconnect and try again.
*
* @param cls arm monitor handle
- * @param tc task context
*/
static void
-init_timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+init_timeout_task (void *cls)
{
struct GNUNET_ARM_MonitorHandle *h = cls;
+
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Init message timed out\n");
-
h->init_timeout_task_id = NULL;
reconnect_arm_monitor_later (h);
}
* jobs that we've been asked to do in order.
*
* @param cls closure, unused
- * @param tc context, unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != h)
{
* Main task that runs our various operations in order.
*
* @param cls closure
- * @param tc scheudler context
*/
static void
-action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+action_loop (void *cls);
/**
* do, in order.
*
* @param cls closure, unused
- * @param tc context, unused
*/
static void
-action_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+action_loop (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Running requested actions\n");
* create the service in order to relay the incoming connection to it
*
* @param cls callback data, `struct ServiceListeningInfo` describing a listen socket
- * @param tc context
*/
static void
-accept_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+accept_connection (void *cls)
{
struct ServiceListeningInfo *sli = cls;
struct ServiceList *sl = sli->sl;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
sli->accept_task = NULL;
GNUNET_assert (GNUNET_NO == in_shutdown);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
start_process (sl, NULL, 0);
* Start a shutdown sequence.
*
* @param cls closure (refers to service)
- * @param tc task context
*/
static void
-trigger_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+trigger_shutdown (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Triggering shutdown\n");
* Task run for shutdown.
*
* @param cls closure, NULL if we need to self-restart
- * @param tc context
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct ServiceList *pos;
struct ServiceList *nxt;
* Task run whenever it is time to restart a child that died.
*
* @param cls closure, always NULL
- * @param tc context
*/
static void
-delayed_restart_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+delayed_restart_task (void *cls)
+
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
struct ServiceList *sl;
struct GNUNET_TIME_Relative lowestRestartDelay;
struct ServiceListeningInfo *sli;
child_restart_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_assert (GNUNET_NO == in_shutdown);
* process died).
*
* @param cls closure, NULL if we need to self-restart
- * @param tc context
*/
static void
-maint_child_death (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+maint_child_death (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
struct ServiceList *pos;
struct ServiceList *next;
struct ServiceListeningInfo *sli;
pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
child_death_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
{
/* shutdown scheduled us, ignore! */
static void
-trigger_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+trigger_disconnect (void *cls)
{
GNUNET_ARM_disconnect_and_free ((struct GNUNET_ARM_Handle *) cls);
}
* Shutting down took too long, cancel receive and return error.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-service_shutdown_cancel (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+service_shutdown_cancel (void *cls)
{
struct ShutdownContext *shutdown_ctx = cls;
static void
-kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc);
+kill_task (void *cbData);
static void
static void
-kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc)
+kill_task (void *cbData)
{
static struct GNUNET_CLIENT_Connection *doNothingConnection = NULL;
static void
-trigger_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+trigger_disconnect (void *cls)
{
GNUNET_ARM_disconnect_and_free (arm);
GNUNET_ARM_monitor_disconnect_and_free (mon);
static void
-trigger_disconnect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+trigger_disconnect (void *cls)
{
GNUNET_ARM_disconnect_and_free (arm);
arm = NULL;
return e_counter;
}
+
static void
-timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc)
+timeout_experiment (void *cls)
{
struct Experiment *e = cls;
e->experiment_timeout_task = NULL;
GNUNET_SYSERR);
}
+
static void
enforce_start_send (struct GNUNET_ATS_TEST_Operation *op)
{
}
}
+
static void
-timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc)
+timeout_episode (void *cls)
{
struct Experiment *e = cls;
+
e->episode_timeout_task = NULL;
if (NULL != e->ep_done_cb)
e->ep_done_cb (e->cur);
}
/* end of file ats-testing-experiment.c*/
-
}
}
+
static void
-collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+collect_log_task (void *cls)
{
struct LoggingHandle *l = cls;
- l->log_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ l->log_task = NULL;
GNUNET_ATS_TEST_logging_now (l);
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
return;
-
l->log_task = GNUNET_SCHEDULER_add_delayed (l->frequency,
- &collect_log_task, l);
+ &collect_log_task,
+ l);
}
+
/**
* Stop logging
*
return l;
}
/* end of file ats-testing-log.c */
-
static void
-set_pref_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+set_pref_task (void *cls)
{
struct BenchmarkPartner *p = cls;
double pref_value;
static void
-comm_schedule_send (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+comm_schedule_send (void *cls)
{
struct BenchmarkPartner *p = cls;
}
/* end of file ats-testing-traffic.c */
-
struct GNUNET_ATS_TEST_Topology *top;
+
/**
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
int c_m;
int c_s;
}
static void
-do_connect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_connect_peers (void *cls)
{
int c_m;
int c_s;
}
static void
-do_comm_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_comm_connect (void *cls)
{
int c_s;
int c_m;
static void
-do_connect_ats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_connect_ats (void *cls)
{
int c_m;
int c_s;
return e_counter;
}
+
static void
-timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc)
+timeout_experiment (void *cls)
{
struct Experiment *e = cls;
e->experiment_timeout_task = NULL;
GNUNET_SYSERR);
}
+
static void
enforce_start_send (struct GNUNET_ATS_TEST_Operation *op)
{
}
}
+
static void
-timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc)
+timeout_episode (void *cls)
{
struct Experiment *e = cls;
e->episode_timeout_task = NULL;
return 0;
}
/* end of file ats-testing-experiment.c*/
-
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (GNUNET_YES == logging)
&print_progress, NULL );
}
+
static void
-ats_pref_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+ats_pref_task (void *cls)
{
struct BenchmarkPeer *me = cls;
}
static void
-collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+collect_log_task (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
log_task = NULL;
collect_log_now();
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
return;
log_task = GNUNET_SCHEDULER_add_delayed (frequency,
- &collect_log_task, NULL);
+ &collect_log_task, NULL);
}
perf_logging_stop ()
{
int c_m;
- struct GNUNET_SCHEDULER_TaskContext tc;
struct PeerLoggingTimestep *cur;
if (GNUNET_YES!= running)
if (NULL != log_task)
GNUNET_SCHEDULER_cancel (log_task);
log_task = NULL;
- tc.reason = GNUNET_SCHEDULER_REASON_SHUTDOWN;
- collect_log_task (NULL, &tc);
+ collect_log_task (NULL);
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
_("Stop logging\n"));
GNUNET_free (lp);
}
+
void
perf_logging_start (struct GNUNET_TIME_Relative log_frequency,
char * testname, struct BenchmarkPeer *masters, int num_masters)
running = GNUNET_YES;
}
/* end of file perf_ats_logging.c */
-
* Task run on shutdown.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
struct PendingResolutions * pr;
struct PendingResolutions * next;
* Re-establish the connection to the ATS service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-reconnect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
struct GNUNET_ATS_ConnectivityHandle *ch = cls;
* Re-establish the connection to the ATS service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-reconnect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
struct GNUNET_ATS_PerformanceHandle *ph = cls;
* Periodically get list of network addresses from our interfaces.
*
* @param cls closure
- * @param tc Task context
*/
static void
-get_addresses (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+get_addresses (void *cls)
{
struct GNUNET_ATS_InterfaceScanner *is = cls;
* Re-establish the connection to the ATS service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-reconnect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
struct GNUNET_ATS_SchedulingHandle *sh = cls;
static void
-logging_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+logging_task (void *cls)
{
struct LoggingHandle *l = cls;
static void
-set_prop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+set_prop_task (void *cls)
{
struct PropertyGenerator *pg = cls;
struct TestPeer *p;
return pref_value;
}
+
static void
-set_feedback_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+set_feedback_task (void *cls)
{
struct PreferenceGenerator *pg = cls;
struct TestPeer *p;
static void
-set_pref_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+set_pref_task (void *cls)
{
struct PreferenceGenerator *pg = cls;
struct TestPeer *p;
return e_counter;
}
+
static void
-timeout_experiment (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc)
+timeout_experiment (void *cls)
{
struct Experiment *e = cls;
+
e->experiment_timeout_task = NULL;
fprintf (stderr, "Experiment timeout!\n");
}
}
+
static void
-timeout_episode (void *cls, const struct GNUNET_SCHEDULER_TaskContext* tc)
+timeout_episode (void *cls)
{
struct Experiment *e = cls;
+
e->episode_timeout_task = NULL;
if (NULL != e->ep_done_cb)
e->ep_done_cb (e->cur);
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-cleanup_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"ATS shutdown initiated\n");
* Reduce absolute preferences since they got old.
*
* @param cls unused
- * @param tc context
*/
static void
-preference_aging (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+preference_aging (void *cls)
{
struct AgeContext ac;
* no further step is scheduled.
*
* @param cls the solver handle
- * @param tc the task context for the scheduler
*/
static void
-ril_step_scheduler_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+ril_step_scheduler_task (void *cls)
{
struct GAS_RIL_Handle *solver = cls;
* Task run to terminate the testcase.
*
* @param cls NULL
- * @param tc unused
*/
static void
-end (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
if (0 != ret)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
* Main interpreter loop. Runs the steps of the test.
*
* @param cls NULL
- * @param tc unused
*/
static void
-interpreter (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+interpreter (void *cls);
/**
* Main interpreter loop. Runs the steps of the test.
*
* @param cls NULL
- * @param tc unused
*/
static void
-interpreter (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+interpreter (void *cls)
{
struct Command *cmd;
* Notify client that the transmission has timed out
*
* @param cls closure
- * @param tc task context
*/
static void
-timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_transmission (void *cls)
{
struct GNUNET_CADET_TransmitHandle *th = cls;
struct GNUNET_CADET_Handle *cadet = th->channel->cadet;
/**
* Reconnect callback: tries to reconnect again after a failer previous
- * reconnecttion
+ * reconnection.
+ *
* @param cls closure (cadet handle)
- * @param tc task context
*/
static void
-reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+reconnect_cbk (void *cls);
/**
/**
* Reconnect callback: tries to reconnect again after a failer previous
* reconnecttion
+ *
* @param cls closure (cadet handle)
- * @param tc task context
*/
static void
-reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_cbk (void *cls)
{
struct GNUNET_CADET_Handle *h = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
h->reconnect_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
do_reconnect (h);
NULL); /* no handler cls */
return mq;
}
-
* Removes the path from the peer (except for direct paths).
*
* @param cls Closure (path to destroy).
- * @param tc Task context.
*/
static void
-path_destroy_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+path_destroy_delayed (void *cls)
{
struct CadetPeerPath *path = cls;
struct CadetPeer *peer;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
LOG (GNUNET_ERROR_TYPE_INFO, "Destroy delayed %p (%u)\n", path, path->length);
path->path_delete = NULL;
/* During shutdown, the peers peermap might not exist anymore. */
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) == 0)
{
if (2 >= path->length)
* on callback funtion ch.
*
* @param cls Closure (unsued).
- * @param tc Task Context.
*/
static void
-start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+start_test (void *cls);
/**
* Shut down peergroup, clean up.
*
* @param cls Closure (unused).
- * @param tc Task Context.
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Ending test.\n");
shutdown_handle = NULL;
* Disconnect from cadet services af all peers, call shutdown.
*
* @param cls Closure (unused).
- * @param tc Task Context.
*/
static void
-disconnect_cadet_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+disconnect_cadet_peers (void *cls)
{
long line = (long) cls;
unsigned int i;
* Task check that keepalives were sent and received.
*
* @param cls Closure (NULL).
- * @param tc Task Context.
*/
static void
-collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+collect_stats (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
* @brief Finish profiler normally. Signal finish and start collecting stats.
*
* @param cls Closure (unused).
- * @param tc Task context.
*/
static void
-finish_profiler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+finish_profiler (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
* @brief Move to next round.
*
* @param cls Closure (round #).
- * @param tc Task context.
*/
static void
-next_rnd (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+next_rnd (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
* @brief Send a ping to destination
*
* @param cls Closure (peer).
- * @param tc Task context.
*/
static void
-ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+ping (void *cls)
{
- struct CadetPeer *peer = (struct CadetPeer *) cls;
+ struct CadetPeer *peer = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
peer->ping_task = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)
|| GNUNET_YES == test_finished)
return;
* on callback funtion ch.
*
* @param cls Closure (unsued).
- * @param tc Task Context.
*/
static void
-start_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+start_test (void *cls)
{
enum GNUNET_CADET_ChannelOption flags;
unsigned long i;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
test_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
}
/* end of gnunet-cadet-profiler.c */
-
* Stops monitoring activity.
*
* @param cls Closure (unused).
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
if (NULL != th)
* Task run in stdio mode, after some data is available at stdin.
*
* @param cls Closure (unused).
- * @param tc scheduler context
*/
static void
-read_stdio (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+read_stdio (void *cls)
{
static char buf[60000];
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
return;
* @brief Send an echo request to the remote peer.
*
* @param cls Closure (NULL).
- * @param tc Task context.
*/
static void
-send_echo (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_echo (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || NULL == ch)
return;
* Call CADET's monitor API, request debug dump on the service.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-request_dump (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+request_dump (void *cls)
{
GNUNET_CADET_request_dump (mh);
GNUNET_SCHEDULER_cancel (sd);
* Call CADET's monitor API, get info of one connection.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-create_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+create_channel (void *cls)
{
struct GNUNET_PeerIdentity pid;
enum GNUNET_CADET_ChannelOption opt;
* Call CADET's meta API, get all peers known to a peer.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-get_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+get_peers (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
* Call CADET's monitor API, get info of one peer.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-show_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+show_peer (void *cls)
{
struct GNUNET_PeerIdentity pid;
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id,
- strlen (peer_id),
- &pid.public_key))
- {
+ GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id,
+ strlen (peer_id),
+ &pid.public_key))
+ {
fprintf (stderr,
_("Invalid peer ID `%s'\n"),
peer_id);
* Call CADET's meta API, get all tunnels known to a peer.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-get_tunnels (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+get_tunnels (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
* Call CADET's monitor API, get info of one tunnel.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-show_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+show_tunnel (void *cls)
{
struct GNUNET_PeerIdentity pid;
* Call CADET's monitor API, get info of one channel.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-show_channel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+show_channel (void *cls)
{
}
* Call CADET's monitor API, get info of one connection.
*
* @param cls Closure (unused).
- * @param tc TaskContext
*/
static void
-show_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+show_connection (void *cls)
{
}
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutting down\n");
* We haven't received an ACK after a certain time: restransmit the message.
*
* @param cls Closure (CadetChannelReliability with the message to restransmit)
- * @param tc TaskContext.
*/
static void
-channel_retransmit_message (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+channel_retransmit_message (void *cls)
{
struct CadetChannelReliability *rel = cls;
struct CadetReliableMessage *copy;
struct CadetChannel *ch;
struct GNUNET_CADET_Data *payload;
int fwd;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
rel->retry_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* We haven't received an Channel ACK after a certain time: resend the CREATE.
*
* @param cls Closure (CadetChannelReliability of the channel to recreate)
- * @param tc TaskContext.
*/
static void
-channel_recreate (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+channel_recreate (void *cls)
{
struct CadetChannelReliability *rel = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
rel->retry_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* Keep the connection alive in the FWD direction.
*
* @param cls Closure (connection to keepalive).
- * @param tc TaskContext.
*/
static void
-connection_fwd_keepalive (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_fwd_keepalive (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
GCC_check_connections ();
+ tc = GNUNET_SCHEDULER_get_task_context ();
connection_keepalive ((struct CadetConnection *) cls,
GNUNET_YES,
tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN);
* Keep the connection alive in the BCK direction.
*
* @param cls Closure (connection to keepalive).
- * @param tc TaskContext.
*/
static void
-connection_bck_keepalive (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_bck_keepalive (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
GCC_check_connections ();
+ tc = GNUNET_SCHEDULER_get_task_context ();
connection_keepalive ((struct CadetConnection *) cls,
GNUNET_NO,
tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN);
* possibly due to a missed ACK. Poll the neighbor about its ACK status.
*
* @param cls Closure (poll ctx).
- * @param tc TaskContext.
*/
static void
-connection_poll (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+connection_poll (void *cls);
/**
* possibly due to a missed ACK. Poll the neighbor about its ACK status.
*
* @param cls Closure (poll ctx).
- * @param tc TaskContext.
*/
static void
-connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_poll (void *cls)
{
struct CadetFlowControl *fc = cls;
struct GNUNET_CADET_Poll msg;
struct CadetConnection *c;
int fwd;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
fc->poll_task = NULL;
GCC_check_connections ();
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
return;
* Destroys connection if called.
*
* @param cls Closure (connection to destroy).
- * @param tc TaskContext.
*/
static void
-connection_fwd_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_fwd_timeout (void *cls)
{
struct CadetConnection *c = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
c->fwd_maintenance_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GCC_check_connections ();
* Destroys connection if called.
*
* @param cls Closure (connection to destroy).
- * @param tc TaskContext
*/
static void
-connection_bck_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_bck_timeout (void *cls)
{
struct CadetConnection *c = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
c->bck_maintenance_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GCC_check_connections ();
* connection with the same path, and destroy one if so.
*
* @param cls Closure (connection to check).
- * @param tc Task context.
*/
static void
-check_duplicates (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+check_duplicates (void *cls)
{
struct CadetConnection *c = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
c->check_duplicates_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* Periodically announce self id in the DHT
*
* @param cls closure
- * @param tc task context
*/
static void
-announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+announce_id (void *cls)
{
struct GNUNET_HashCode phash;
const struct GNUNET_HELLO_Message *hello;
size_t size;
struct GNUNET_TIME_Absolute expiration;
struct GNUNET_TIME_Relative retry_time;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
announce_id_task = NULL;
* @brief Start a search for a peer.
*
* @param cls Closure (Peer to search for).
- * @param tc Task context.
*/
static void
-delayed_search (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delayed_search (void *cls)
{
struct CadetPeer *peer = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
peer->search_delayed = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
GCC_check_connections ();
* Marks the operation as finished.
*
* @param cls Closure (our `struct CadetPeer`).
- * @param tc TaskContext.
*/
static void
-hello_offer_done (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+hello_offer_done (void *cls)
{
struct CadetPeer *peer = cls;
* @brief Finish the Key eXchange and destroy the old keys.
*
* @param cls Closure (Tunnel for which to finish the KX).
- * @param tc Task context.
*/
static void
-finish_kx (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+finish_kx (void *cls)
{
struct CadetTunnel *t = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
LOG (GNUNET_ERROR_TYPE_INFO, "finish KX for %s\n", GCT_2s (t));
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
LOG (GNUNET_ERROR_TYPE_INFO, " shutdown\n");
* @brief Resend the AX KX until we complete the handshake.
*
* @param cls Closure (tunnel).
- * @param tc Task context.
*/
static void
-ax_kx_resend (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+ax_kx_resend (void *cls)
{
struct CadetTunnel *t = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
t->rekey_task = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* Initiate a rekey with the remote peer.
*
* @param cls Closure (tunnel).
- * @param tc TaskContext.
*/
static void
-rekey_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+rekey_tunnel (void *cls)
{
struct CadetTunnel *t = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
t->rekey_task = NULL;
-
LOG (GNUNET_ERROR_TYPE_INFO, "Re-key Tunnel %s\n", GCT_2s (t));
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
* Create a new ephemeral key and key message, schedule next rekeying.
*
* @param cls Closure (unused).
- * @param tc TaskContext.
*/
static void
-global_otr_rekey (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+global_otr_rekey (void *cls)
{
struct GNUNET_TIME_Absolute time;
long n;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
rekey_task = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
GNUNET_break (0);
return;
}
- rekey_tunnel (t, NULL);
+ rekey_tunnel (t);
GNUNET_STATISTICS_update (stats, "# otr-downgrades", -1, GNUNET_NO);
}
}
if (NULL != t->rekey_task)
GNUNET_SCHEDULER_cancel (t->rekey_task);
- t->rekey_task = GNUNET_SCHEDULER_add_now (rekey_tunnel, t);
+ t->rekey_task = GNUNET_SCHEDULER_add_now (&rekey_tunnel, t);
}
if (CADET_TUNNEL_KEY_SENT == t->estate)
{
* of being created/processed.
*
* @param cls Closure (Tunnel to check).
- * @param tc Task context.
*/
static void
-trim_connections (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+trim_connections (void *cls)
{
struct CadetTunnel *t = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
t->trim_connections_task = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* the tunnel. This way we avoid a new public key handshake.
*
* @param cls Closure (tunnel to destroy).
- * @param tc Task context.
*/
static void
-delayed_destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delayed_destroy (void *cls)
{
struct CadetTunnel *t = cls;
struct CadetTConnection *iter;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
LOG (GNUNET_ERROR_TYPE_DEBUG, "delayed destroying tunnel %p\n", t);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
* @param tc Task Context.
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending test.\n");
shutdown_handle = NULL;
* @param tc Task Context.
*/
static void
-disconnect_cadet_peers (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+disconnect_cadet_peers (void *cls)
{
long line = (long) cls;
unsigned int i;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"disconnecting cadet peers due to SHUTDOWN! called from %ld\n",
* Task to gather all statistics.
*
* @param cls Closure (NULL).
- * @param tc Task Context.
*/
static void
-gather_stats_and_exit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+gather_stats_and_exit (void *cls)
{
- disconnect_task = NULL;
long l = (long) cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ disconnect_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "gathering statistics from line %d\n", l);
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
{
disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_cadet_peers,
* Task to request a new data transmission.
*
* @param cls Closure (peer #).
- * @param tc Task Context.
*/
static void
-data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+data_task (void *cls)
{
struct GNUNET_CADET_Channel *channel;
static struct GNUNET_CADET_TransmitHandle **pth;
-
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
long src;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n");
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
* on callback function ch.
*
* @param cls Closure (unused).
- * @param tc Task Context.
*/
static void
-do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_test (void *cls)
{
enum GNUNET_CADET_ChannelOption flags;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
}
/* end of test_cadet.c */
-
* Connect to other client and send data
*
* @param cls Closue (unused).
- * @param tc TaskContext.
*/
static void
-do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_connect (void *cls);
/**
* Shutdown nicely
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
if (NULL != abort_task)
* Something went wrong and timed out. Kill everything and set error flag
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n");
result = GNUNET_SYSERR;
GNUNET_SCHEDULER_cancel (shutdown_task);
shutdown_task = NULL;
}
- do_shutdown (cls, tc);
+ do_shutdown (cls);
}
if (NULL != shutdown_task)
GNUNET_SCHEDULER_cancel (shutdown_task);
shutdown_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown,
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+ &do_shutdown,
NULL);
GNUNET_CADET_receive_done (channel);
return GNUNET_OK;
* (can be NULL -- that's not an error)
*/
static void *
-inbound_channel (void *cls, struct GNUNET_CADET_Channel *channel,
- const struct GNUNET_PeerIdentity *initiator,
- uint32_t port, enum GNUNET_CADET_ChannelOption options)
+inbound_channel (void *cls,
+ struct GNUNET_CADET_Channel *channel,
+ const struct GNUNET_PeerIdentity *initiator,
+ uint32_t port,
+ enum GNUNET_CADET_ChannelOption options)
{
long id = (long) cls;
* Connect to other client and send data
*
* @param cls Closue (unused).
- * @param tc TaskContext.
*/
static void
-do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_connect (void *cls)
{
struct GNUNET_PeerIdentity id;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
* Shutdown nicely
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
if (NULL != abort_task)
* Something went wrong and timed out. Kill everything and set error flag
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n");
result = GNUNET_SYSERR;
GNUNET_SCHEDULER_cancel (shutdown_task);
shutdown_task = NULL;
}
- do_shutdown (cls, tc);
+ do_shutdown (cls);
}
* Connect to other client and send data
*
* @param cls Closue (unused).
- * @param tc TaskContext.
*/
static void
-do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_connect (void *cls)
{
struct GNUNET_PeerIdentity id;
size_t size = sizeof (struct GNUNET_MessageHeader) + DATA_SIZE;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
* @param subsystem name of subsystem that created the statistic
* @param name the name of the datum
* @param value the current value
- * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
- * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
+ * @param is_persistent #GNUNET_YES if the value is persistent, #GNUNET_NO if not
+ * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
*/
static int
statistics_cb (void *cls,
static void
-destroy (void *cls, const struct GNUNET_SCHEDULER_TaskContext *ctx)
+destroy (void *cls)
{
struct GNUNET_CONSENSUS_Handle *consensus = cls;
options, &run, NULL, GNUNET_YES);
return 0;
}
-
* Called to clean up, after a shutdown has been requested.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
while (NULL != sessions_head)
destroy_session (sessions_head);
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-on_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+on_shutdown (void *cls)
{
if (NULL != consensus)
{
&run, NULL);
return ret;
}
-
* Terminate test.
*
* @param cls NULL
- * @param tc unused
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
struct Recording *rec;
* Terminate recording process and switch to playback.
*
* @param cls NULL
- * @param tc unused
*/
static void
-switch_to_speaker (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+switch_to_speaker (void *cls)
{
struct Recording *rec;
* Task run during shutdown.
*
* @param cls NULL
- * @param tc unused
*/
static void
-do_stop_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_stop_task (void *cls)
{
#ifdef WINDOWS
if (NULL != stdin_hlp)
* Task to handle commands from the terminal.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-handle_command (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+handle_command (void *cls)
{
char message[MAX_MESSAGE_LENGTH + 1];
* Shutdown nicely
*
* @param cls closure, NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
struct Line *line;
struct Channel *ch;
static void
-phone_send (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+phone_send (void *cls)
{
static unsigned int i;
char buf[32];
static void
-call_send (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+call_send (void *cls)
{
static unsigned int i;
char buf[32];
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_test (void *cls)
{
GNUNET_SCHEDULER_shutdown ();
if (NULL != op)
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_test (void *cls)
{
GNUNET_SCHEDULER_shutdown ();
if (NULL != op)
static void
-phone_send (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+phone_send (void *cls)
{
char buf[32];
static void
-call_send (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+call_send (void *cls)
{
struct MicContext *mc = cls;
char buf[32];
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_test (void *cls)
{
GNUNET_SCHEDULER_shutdown ();
if (NULL != op)
* @param tc task context
*/
static void
-reconnect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
struct GNUNET_CORE_Handle *h = cls;
* Task that calls #request_next_transmission().
*
* @param cls the `struct PeerRecord *`
- * @param tc scheduler context
*/
static void
-run_request_next_transmission (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_request_next_transmission (void *cls)
{
struct PeerRecord *pr = cls;
* Stops monitoring activity.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != mh)
{
* the transport.
*
* @param cls NULL, unused
- * @param tc scheduler context, unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Core service shutting down.\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Core service shutting down.\n");
GSC_CLIENTS_done ();
GSC_NEIGHBOURS_done ();
GSC_SESSIONS_done ();
* Task that will retry #send_key() if our previous attempt failed.
*
* @param cls our `struct GSC_KeyExchangeInfo`
- * @param tc scheduler context
*/
static void
-set_key_retry_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+set_key_retry_task (void *cls)
{
struct GSC_KeyExchangeInfo *kx = cls;
* (and we should prevent this by sending a PING).
*
* @param cls the `struct GSC_KeyExchangeInfo`
- * @param tc scheduler context (not used)
*/
static void
-send_keep_alive (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_keep_alive (void *cls)
{
struct GSC_KeyExchangeInfo *kx = cls;
struct GNUNET_TIME_Relative retry;
* Task run to trigger rekeying.
*
* @param cls closure, NULL
- * @param tc scheduler context
*/
static void
-do_rekey (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_rekey (void *cls)
{
struct GSC_KeyExchangeInfo *pos;
* (Done periodically until the typemap is confirmed).
*
* @param cls the `struct Session *`
- * @param tc unused
*/
static void
-transmit_typemap_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_typemap_task (void *cls)
{
struct Session *session = cls;
struct GNUNET_MessageHeader *hdr;
* Send them now.
*
* @param cls `struct Session` with the messages to transmit now
- * @param tc scheduler context (unused)
*/
static void
-pop_cork_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+pop_cork_task (void *cls)
{
struct Session *session = cls;
static void
-terminate_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task (void *cls)
{
GNUNET_assert (ok == 6);
terminate_peer (&p1);
static void
-terminate_task_error (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task_error (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"ENDING ANGRILY %u\n",
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n");
GNUNET_MQ_destroy (mq);
static void
-terminate_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task (void *cls)
{
unsigned long long delta;
static void
-terminate_task_error (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task_error (void *cls)
{
GNUNET_break (0);
terminate_peer (&p1);
* Function scheduled as very last function, cleans up after us
*/
static void
-cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tskctx)
+cleanup (void *cls)
{
die_task = NULL;
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_CORE_disconnect (p1.ch);
p1.ch = NULL;
static void
-timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_task (void *cls)
{
FPRINTF (stderr, "%s", "Timeout.\n");
if (p1.ch != NULL)
static void
-terminate_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task (void *cls)
{
err_task = NULL;
terminate_peer (&p1);
static void
-terminate_task_error (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task_error (void *cls)
{
- err_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ err_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Testcase failed!\n");
static void
-measurement_stop (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+measurement_stop (void *cls)
{
unsigned long long delta;
unsigned long long throughput_out;
* Task used by 'transmit_drop' to disconnect the datastore.
*
* @param cls the datastore handle
- * @param tc scheduler context
*/
static void
-disconnect_after_drop (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+disconnect_after_drop (void *cls)
{
struct GNUNET_DATASTORE_Handle *h = cls;
* A request has timed out (before being transmitted to the service).
*
* @param cls the `struct GNUNET_DATASTORE_QueueEntry`
- * @param tc scheduler context
*/
static void
-timeout_queue_entry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_queue_entry (void *cls)
{
struct GNUNET_DATASTORE_QueueEntry *qe = cls;
struct GNUNET_DATASTORE_Handle *h = qe->h;
* Try reconnecting to the datastore service.
*
* @param cls the `struct GNUNET_DATASTORE_Handle`
- * @param tc scheduler context
*/
static void
-try_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+try_reconnect (void *cls)
{
struct GNUNET_DATASTORE_Handle *h = cls;
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != qe)
GNUNET_DATASTORE_cancel (qe);
* content quickly.
*
* @param cls not used
- * @param tc task context
*/
static void
-delete_expired (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+delete_expired (void *cls);
/**
* content quickly.
*
* @param cls not used
- * @param tc task context
*/
static void
-delete_expired (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delete_expired (void *cls)
{
expired_kill_task = NULL;
plugin->api->get_expiration (plugin->api->cls, &expired_processor, NULL);
* Task run during shutdown.
*/
static void
-cleaning_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleaning_task (void *cls)
{
struct TransmitCallbackContext *tcc;
* depending on the current state.
*
* @param cls the `struct CpsRunContext`
- * @param tc scheduler context (unused)
*/
static void
-run_continuation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+run_continuation (void *cls);
/**
* depending on the current state.
*
* @param cls the `struct CpsRunContext`
- * @param tc scheduler context (unused)
*/
static void
-run_continuation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_continuation (void *cls)
{
struct CpsRunContext *crc = cls;
size_t size;
static struct GNUNET_HashCode key;
static char data[65536];
char gstr[128];
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
crc->phase = RP_ERROR;
ok = (int) crc->phase;
static void
-test (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+test (void *cls);
/**
static void
put_continuation (void *cls,
const struct GNUNET_HashCode *key,
- uint32_t size,
- int status,
+ uint32_t size,
+ int status,
const char *msg)
{
struct CpsRunContext *crc = cls;
* the transport and core.
*/
static void
-cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleaning_task (void *cls)
{
struct CpsRunContext *crc = cls;
static void
-test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+test (void *cls)
{
struct CpsRunContext *crc = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
GNUNET_break (0);
* depending on the current state.
*
* @param cls the `struct CpsRunContext`
- * @param tc scheduler context (unused)
*/
static void
-run_continuation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+run_continuation (void *cls);
/**
* depending on the current state.
*
* @param cls the `struct CpsRunContext`
- * @param tc scheduler context (unused)
*/
static void
-run_continuation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_continuation (void *cls)
{
struct CpsRunContext *crc = cls;
static void
-run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+run_continuation (void *cls);
static void
static void
-run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_continuation (void *cls)
{
struct CpsRunContext *crc = cls;
static void
-test (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+test (void *cls);
/**
* @param msg error message on error
*/
static void
-put_continuation (void *cls,
+put_continuation (void *cls,
const struct GNUNET_HashCode *key,
- uint32_t size,
- int status,
+ uint32_t size,
+ int status,
const char *msg)
{
struct CpsRunContext *crc = cls;
* the transport and core.
*/
static void
-cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleaning_task (void *cls)
{
struct CpsRunContext *crc = cls;
static void
-update_continuation (void *cls,
+update_continuation (void *cls,
int status,
const char *msg)
{
static void
-test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+test (void *cls)
{
struct CpsRunContext *crc = cls;
struct GNUNET_HashCode key;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test aborted.\n");
case RP_UPDATE:
crc->api->update (crc->api->cls,
guid,
- 1,
+ 1,
GNUNET_TIME_UNIT_ZERO_ABS,
- &update_continuation,
+ &update_continuation,
crc);
break;
char *libname;
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg,
- "DATASTORE",
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "DATASTORE",
"DATABASE",
&name))
{
FPRINTF (stderr, "Failed to load plugin `%s'!\n", name);
GNUNET_free (libname);
GNUNET_free (name);
- ok = 77; /* mark test as skipped */
+ ok = 77; /* mark test as skipped */
return NULL;
}
GNUNET_free (libname);
* Did we start our receive loop yet?
*/
int in_receive;
-
+
#if ENABLE_MALICIOUS
/**
* Handle of act malicious request.
* Try reconnecting to the dht service.
*
* @param cls a `struct GNUNET_DHT_Handle`
- * @param tc scheduler context
*/
static void
-try_reconnect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+try_reconnect (void *cls)
{
struct GNUNET_DHT_Handle *handle = cls;
head->in_pending_queue = GNUNET_NO;
if (NULL != head->cont)
{
- head->cont (head->cont_cls, NULL);
+ head->cont (head->cont_cls);
head->cont = NULL;
head->cont_cls = NULL;
}
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting to process replies from DHT\n");
handle->in_receive = GNUNET_YES;
-
+
GNUNET_CLIENT_receive (handle->client, &service_message_handler, handle,
GNUNET_TIME_UNIT_FOREVER_REL);
}
struct GNUNET_DHT_ActMaliciousHandle *mh;
GNUNET_DHT_PutContinuation cont;
void *cont_cls;
-
+
mh = handle->mh;
if (NULL == mh)
return GNUNET_OK;
cont_cls = mh->cont_cls;
if (NULL != cont)
cont (cont_cls, GNUNET_OK);
-
+
return GNUNET_OK;
}
#endif
pm->in_pending_queue = GNUNET_NO;
GNUNET_assert (GNUNET_YES == pm->free_on_send);
if (NULL != pm->cont)
- pm->cont (pm->cont_cls, NULL);
+ pm->cont (pm->cont_cls);
GNUNET_free (pm);
}
while (NULL != (ph = handle->put_head))
* Timeout for the transmission of a fire&forget-request. Clean it up.
*
* @param cls the `struct GNUNET_DHT_PutHandle *`
- * @param tc scheduler context
*/
static void
-timeout_put_request (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_put_request (void *cls)
{
struct GNUNET_DHT_PutHandle *ph = cls;
struct GNUNET_DHT_Handle *handle = ph->dht_handle;
* the message pointer in the put handle to NULL.
*
* @param cls the `struct GNUNET_DHT_PutHandle`
- * @param tc unused
*/
static void
-mark_put_message_gone (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+mark_put_message_gone (void *cls)
{
struct GNUNET_DHT_PutHandle *ph = cls;
* @param handle the DHT handle
* @param action 1 to make the service malicious; 0 to make it benign
* @param cont continuation to call when done (transmitting request to service)
- * @param cont_cls closure for @a cont
+ * @param cont_cls closure for @a cont
*/
struct GNUNET_DHT_ActMaliciousHandle *
-GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle,
+GNUNET_DHT_act_malicious (struct GNUNET_DHT_Handle *handle,
unsigned int action,
GNUNET_DHT_PutContinuation cont,
void *cont_cls)
struct GNUNET_DHT_ActMaliciousHandle *mh;
struct PendingMessage *pending;
size_t msize;
-
+
msize = sizeof(struct GNUNET_DHT_ActMaliciousMessage);
if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
* Task run to clean up on timeout.
*
* @param cls unused
- * @param tc unused
*/
static void
-cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
if (NULL != get_handle)
{
* Stop monitoring request and start shutdown
*
* @param cls closure (unused)
- * @param tc Task Context
*/
static void
-cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
if (verbose)
FPRINTF (stderr, "%s", "Cleaning up!\n");
*/
static char *data;
+
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != dht_handle)
{
* Signature of the main function of a task.
*
* @param cls closure
- * @param success GNUNET_OK if the PUT was transmitted,
- * GNUNET_NO on timeout,
- * GNUNET_SYSERR on disconnect from service
+ * @param success #GNUNET_OK if the PUT was transmitted,
+ * #GNUNET_NO on timeout,
+ * #GNUNET_SYSERR on disconnect from service
* after the PUT message was transmitted
* (so we don't know if it was received or not)
*/
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != ghh)
{
GDS_CLIENTS_init (server);
if (GNUNET_OK != GDS_NEIGHBOURS_init ())
{
- shutdown_task (NULL, NULL);
+ shutdown_task (NULL);
return;
}
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+ &shutdown_task,
NULL);
GDS_transport_handle =
GNUNET_TRANSPORT_connect (GDS_cfg, NULL, NULL, NULL, NULL, NULL);
* itself (unless the heap is empty).
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-transmit_next_request_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_next_request_task (void *cls)
{
struct ClientQueryRecord *cqr;
struct GNUNET_TIME_Relative delay;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
retry_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap)))
* Clean up the "oh" field in the @a cls
*
* @param cls a `struct ConnectInfo`
- * @param tc unused
*/
static void
-offer_hello_done (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+offer_hello_done (void *cls)
{
struct ConnectInfo *ci = cls;
* and attempt to connect to them.
*
* @param cls closure for this task
- * @param tc the context under which the task is running
*/
static void
-send_find_peer_message (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_find_peer_message (void *cls)
{
struct GNUNET_TIME_Relative next_send_time;
struct BloomConstructorContext bcc;
struct GNUNET_CONTAINER_BloomFilter *peer_bf;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
find_peer_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
if (newly_found_peers > bucket_size)
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GDS_NEIGHBOURS_done ();
GDS_DATACACHE_done ();
GDS_CLIENTS_init (server);
if (GNUNET_OK != GDS_NEIGHBOURS_init ())
{
- shutdown_task (NULL, NULL);
+ shutdown_task (NULL);
return;
}
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
* itself (unless the heap is empty).
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-transmit_next_request_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_next_request_task (void *cls)
{
struct ClientQueryRecord *cqr;
struct GNUNET_TIME_Relative delay;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
retry_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap)))
* possibly initiate cleanup.
*
* @param cls NULL
- * @param tc unused
*/
static void
-trail_timeout_callback (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+trail_timeout_callback (void *cls)
{
struct Trail *trail;
struct GNUNET_TIME_Relative left;
* Initiate a random walk.
*
* @param cls NULL
- * @param tc unused
*/
static void
-do_random_walk (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_random_walk (void *cls)
{
static unsigned int walk_layer;
struct FriendInfo *friend;
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GDS_NEIGHBOURS_done ();
GDS_DATACACHE_done ();
}
if (GNUNET_OK != GDS_NEIGHBOURS_init ())
{
- shutdown_task (NULL, NULL);
+ shutdown_task (NULL);
return;
}
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
* itself (unless the heap is empty).
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-transmit_next_request_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_next_request_task (void *cls)
{
struct ClientQueryRecord *cqr;
struct GNUNET_TIME_Relative delay;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
retry_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
while (NULL != (cqr = GNUNET_CONTAINER_heap_remove_root (retry_heap)))
* finger identity through this random friend.
*
* @param cls closure for this task
- * @param tc the context under which the task is running
*/
static void
-send_find_finger_trail_message (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_find_finger_trail_message (void *cls)
{
struct FriendInfo *target_friend;
struct GNUNET_HashCode trail_id;
* Periodic task to verify current successor. There can be multiple trails to reach
* to successor, choose the shortest one and send verify successor message
* across that trail.
+ *
* @param cls closure for this task
- * @param tc the context under which the task is running
*/
static void
-send_verify_successor_message (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_verify_successor_message (void *cls)
{
struct FriendInfo *target_friend;
struct GNUNET_HashCode trail_id;
unsigned int num_retries_scheduled;
};
+
void
-send_notify_new_successor (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext
- * tc);
+send_notify_new_successor (void *cls);
+
/**
* Check if the peer which sent us verify successor result message is still ours
void
-send_notify_new_successor (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext
- * tc)
+send_notify_new_successor (void *cls)
{
- struct SendNotifyContext *ctx = (struct SendNotifyContext *) cls;
+ struct SendNotifyContext *ctx = cls;
GDS_NEIGHBOURS_send_notify_new_successor (ctx->source_peer,
ctx->successor,
*/
static unsigned int tries;
+
/**
* Task that collects successor statistics from all the peers.
+ *
* @param cls
- * @param tc
*/
static void
-collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+collect_stats (void *cls);
+
/**
* Connect to DHT services of active peers
*/
static void
-start_profiling();
+start_profiling (void);
+
/**
* Shutdown task. Cleanup all resources and operations.
*
* @param cls NULL
- * @param tc scheduler task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
struct ActiveContext *ac;
unsigned int cnt;
* Task to cancel DHT GET.
*
* @param cls NULL
- * @param tc scheduler task context
*/
static void
-cancel_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cancel_get (void *cls)
{
struct ActiveContext *ac = cls;
struct Context *ctx = ac->ctx;
* Task to do DHT GETs
*
* @param cls the active context
- * @param tc the scheduler task context
*/
static void
-delayed_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delayed_get (void *cls)
{
struct ActiveContext *ac = cls;
struct ActiveContext *get_ac;
* clear the operation during shutdown.
*
* @param cls the context
- * @return tc scheduler task context.
*/
static void
-teardown_dht_connection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+teardown_dht_connection (void *cls)
{
struct Context *ctx = cls;
struct GNUNET_TESTBED_Operation *op;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
GNUNET_assert (NULL != ctx);
/**
- * Task to do DHT PUTS
+ * Task to do DHT PUTs
*
* @param cls the active context
- * @param tc the scheduler task context
*/
static void
-delayed_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delayed_put (void *cls)
{
struct ActiveContext *ac = cls;
* Task that collects peer and its corresponding successors.
*
* @param cls Closure (NULL).
- * @param tc Task Context.
*/
static void
-collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+collect_stats (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
return;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start collecting statistics...\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Start collecting statistics...\n");
GNUNET_assert(NULL != testbed_handles);
if (0 != max_searches)
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
GNUNET_SCHEDULER_cancel (die_task);
die_task = NULL;
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-test_get_stop (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+test_get_stop (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Called test_get_stop!\n");
* the testbed.
*
* @param cls the 'struct GNUNET_DHT_TestContext'
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct GNUNET_DHT_TEST_Context *ctx = cls;
unsigned int i;
* Task to put the id of each peer into the DHT.
*
* @param cls array with NUM_PEERS DHT handles
- * @param tc Task context
*/
static void
-do_puts (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_puts (void *cls)
{
struct GNUNET_DHT_Handle **hs = cls;
struct GNUNET_HashCode key;
* the testbed.
*
* @param cls the 'struct GNUNET_DHT_TestContext'
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct GNUNET_DHT_TEST_Context *ctx = cls;
struct GetOperation *get_op;
* @param tc Task context
*/
static void
-do_puts (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_puts (void *cls)
{
struct GNUNET_DHT_Handle **hs = cls;
struct GNUNET_HashCode key;
* @param tc scheduler context (unused)
*/
static void
-reconnect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect (void *cls)
{
struct GNUNET_DNS_Handle *dh = cls;
struct ReplyQueueEntry *qe;
* @param reply reply data
*/
void
-GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh,
+GNUNET_DNS_request_answer (struct GNUNET_DNS_RequestHandle *rh,
uint16_t reply_length,
const char *reply)
{
* Read a DNS response from the (unhindered) UDP-Socket
*
* @param cls socket to read from
- * @param tc scheduler context (must be shutdown or read ready)
*/
static void
-read_response (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+read_response (void *cls);
/**
* Read a DNS response from the (unhindered) UDP-Socket
*
* @param cls socket to read from
- * @param tc scheduler context (must be shutdown or read ready)
*/
static void
-read_response (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+read_response (void *cls)
{
struct GNUNET_DNSSTUB_RequestSocket *rs = cls;
struct GNUNET_NETWORK_FDSet *rset;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
rs->read_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
{
/* timeout or shutdown */
* Shutdown.
*/
static void
-do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_disconnect (void *cls)
{
if (NULL != handle)
{
* Shutdown.
*/
static void
-do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_disconnect (void *cls)
{
if (NULL != handle)
{
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-cleanup_task (void *cls GNUNET_UNUSED,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls GNUNET_UNUSED)
{
unsigned int i;
* Task run on shutdown.
*
* @param cls NULL
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_DV_service_disconnect (sh);
sh = NULL;
*
* @param cls the 'struct DirectNeighbor' of the peer we're building
* a routing consensus with
- * @param tc scheduler context
*/
static void
-initiate_set_union (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+initiate_set_union (void *cls);
/**
* Task to run #refresh_routes() on all direct neighbours.
*
* @param cls NULL
- * @param tc unused
*/
static void
-refresh_routes_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+refresh_routes_task (void *cls)
{
rr_task = NULL;
GNUNET_CONTAINER_multipeermap_iterate (direct_neighbors,
*
* @param cls the `struct DirectNeighbor *` of the peer we're building
* a routing consensus with
- * @param tc scheduler context
*/
static void
-initiate_set_union (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+initiate_set_union (void *cls)
{
struct DirectNeighbor *neighbor = cls;
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
unsigned int i;
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_task = NULL;
if (NULL != topology_op)
* @param tc scheduler context
*/
static void
-dummy_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+dummy_task (void *cls)
{
/* just terminate */
}
* @param tc scheduler context
*/
static void
-cleanup (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup (void *cls)
{
unsigned int i;
* DHT. This task is run periodically to do the DHT PUT.
*
* @param cls closure
- * @param tc scheduler context
*/
static void
-do_dht_put (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_dht_put (void *cls);
/**
* DHT. This task is run periodically to do the DHT PUT.
*
* @param cls closure
- * @param tc scheduler context
*/
static void
-do_dht_put (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_dht_put (void *cls)
{
struct GNUNET_TIME_Absolute expiration;
* Send acknowledgement to the other peer now.
*
* @param cls the message context
- * @param tc the scheduler context
*/
static void
-send_ack (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_ack (void *cls)
{
struct MessageContext *mc = cls;
struct GNUNET_DEFRAGMENT_Context *dc = mc->dc;
* Transmit the next fragment to the other peer.
*
* @param cls the `struct GNUNET_FRAGMENT_Context`
- * @param tc scheduler context
*/
static void
-transmit_next (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_next (void *cls)
{
struct GNUNET_FRAGMENT_Context *fc = cls;
char msg[fc->mtu];
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
ret = 0;
shutdown_task = NULL;
static struct GNUNET_FRAGMENT_Context *frags[NUM_MSGS];
-static struct GNUNET_SCHEDULER_Task * shutdown_task;
+static struct GNUNET_SCHEDULER_Task *shutdown_task;
+
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
unsigned int i;
* and stopping others.
*
* @param cls the `struct GNUNET_FS_Handle *`
- * @param tc scheduler context
*/
static void
-process_job_queue (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+process_job_queue (void *cls)
{
struct GNUNET_FS_Handle *h = cls;
struct GNUNET_FS_QueueEntry *qe;
* Main function that performs the upload.
*
* @param cls `struct GNUNET_FS_PublishContext` identifies the upload
- * @param tc task context
*/
void
-GNUNET_FS_publish_main_ (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+GNUNET_FS_publish_main_ (void *cls);
/**
* request for the file.
*
* @param cls the 'struct GNUNET_FS_DownloadContext'
- * @param tc scheduler context
*/
void
-GNUNET_FS_download_start_task_ (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+GNUNET_FS_download_start_task_ (void *cls);
* Task run last to shut everything down.
*
* @param cls the 'struct GNUNET_FS_DirScanner'
- * @param tc unused
*/
static void
-finish_scan (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+finish_scan (void *cls)
{
struct GNUNET_FS_DirScanner *ds = cls;
* Reconnect to the FS service and transmit our queries NOW.
*
* @param cls our download context
- * @param tc unused
*/
static void
-do_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_reconnect (void *cls)
{
struct GNUNET_FS_DownloadContext *dc = cls;
struct GNUNET_CLIENT_Connection *client;
* the current IBlock from the existing file.
*
* @param cls the 'struct ReconstructContext'
- * @param tc scheduler context
*/
static void
-reconstruct_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconstruct_cont (void *cls)
{
struct GNUNET_FS_DownloadContext *dc = cls;
* Task requesting the next block from the tree encoder.
*
* @param cls the 'struct GNUJNET_FS_DownloadContext' we're processing
- * @param tc task context
*/
static void
-get_next_block (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+get_next_block (void *cls)
{
struct GNUNET_FS_DownloadContext *dc = cls;
* request for the file.
*
* @param cls the 'struct GNUNET_FS_DownloadContext'
- * @param tc scheduler context
*/
void
-GNUNET_FS_download_start_task_ (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+GNUNET_FS_download_start_task_ (void *cls)
{
struct GNUNET_FS_DownloadContext *dc = cls;
struct GNUNET_FS_ProgressInfo pi;
* the final result.
*
* @param cls our publishing context
- * @param tc scheduler's task context (not used)
*/
static void
-encode_cont (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+encode_cont (void *cls)
{
struct GNUNET_FS_PublishContext *pc = cls;
struct GNUNET_FS_FileInformation *p;
* Main function that performs the upload.
*
* @param cls `struct GNUNET_FS_PublishContext *` identifies the upload
- * @param tc task context
*/
void
-GNUNET_FS_publish_main_ (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+GNUNET_FS_publish_main_ (void *cls)
{
struct GNUNET_FS_PublishContext *pc = cls;
struct GNUNET_FS_ProgressInfo pi;
* of the keywords).
*
* @param cls closure of type `struct PublishKskContext *`
- * @param tc unused
*/
static void
-publish_ksk_cont (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+publish_ksk_cont (void *cls);
/**
* publishing operation (iterating over all of the keywords).
*
* @param cls closure of type `struct GNUNET_FS_PublishKskContext *`
- * @param tc unused
*/
static void
-publish_ksk_cont (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+publish_ksk_cont (void *cls)
{
struct GNUNET_FS_PublishKskContext *pkc = cls;
const char *keyword;
* Run the continuation.
*
* @param cls the `struct GNUNET_FS_PublishUblockContext *`
- * @param tc scheduler context
*/
static void
-run_cont (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_cont (void *cls)
{
struct GNUNET_FS_PublishUblockContext *uc = cls;
* Handle the case where we have failed to receive a response for our probe.
*
* @param cls our `struct GNUNET_FS_SearchResult *`
- * @param tc scheduler context
*/
static void
-probe_failure_handler (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+probe_failure_handler (void *cls)
{
struct GNUNET_FS_SearchResult *sr = cls;
* Handle the case where we have gotten a response for our probe.
*
* @param cls our `struct GNUNET_FS_SearchResult *`
- * @param tc scheduler context
*/
static void
-probe_success_handler (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+probe_success_handler (void *cls)
{
struct GNUNET_FS_SearchResult *sr = cls;
* Task run periodically to remind clients that a probe is active.
*
* @param cls the `struct GNUNET_FS_SearchResult` that we are probing for
- * @param tc scheduler context
*/
static void
-probe_ping_task_cb (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+probe_ping_task_cb (void *cls)
{
struct GNUNET_FS_Handle *h = cls;
struct GNUNET_FS_SearchResult *sr;
* our queries NOW.
*
* @param cls our search context
- * @param tc unused
*/
static void
-do_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_reconnect (void *cls)
{
struct GNUNET_FS_SearchContext *sc = cls;
struct GNUNET_CLIENT_Connection *client;
GNUNET_assert (NULL == sc->client);
GNUNET_assert (NULL == sc->task);
- do_reconnect (sc, NULL);
+ do_reconnect (sc);
GNUNET_FS_search_sync_ (sc);
pi.status = GNUNET_FS_STATUS_SEARCH_CONTINUED;
sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc);
* @param tc scheduler context (unused)
*/
static void
-report_uri (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+report_uri (void *cls)
{
struct TestPublishOperation *po = cls;
* Task scheduled to run when publish operation times out.
*
* @param cls the publish operation context
- * @param tc scheduler context (unused)
*/
static void
-publish_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+publish_timeout (void *cls)
{
struct TestPublishOperation *po = cls;
* Task scheduled to run when download operation times out.
*
* @param cls the download operation context
- * @param tc scheduler context (unused)
*/
static void
-download_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+download_timeout (void *cls)
{
struct TestDownloadOperation *dop = cls;
* Task scheduled to report on the completion of our download operation.
*
* @param cls the download operation context
- * @param tc scheduler context (unused)
*/
static void
-report_success (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+report_success (void *cls)
{
struct TestDownloadOperation *dop = cls;
te->uri->data.chk.chk = te->chk_tree[off];
te->uri->data.chk.file_length = GNUNET_htonll (te->size);
te->in_next = GNUNET_NO;
- te->cont (te->cls, NULL);
+ te->cont (te->cls);
return;
}
if (0 == te->current_depth)
te->reader (te->cls, te->publish_offset, pt_size, iob, &te->emsg))
{
te->in_next = GNUNET_NO;
- te->cont (te->cls, NULL);
+ te->cont (te->cls);
return;
}
pt_block = iob;
* processed all blocks. Clean up.
*
* @param cls our unindexing context
- * @param tc not used
*/
static void
-unindex_extract_keywords (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+unindex_extract_keywords (void *cls)
{
struct GNUNET_FS_UnindexContext *uc = cls;
* Task run on shutdown. Serializes our current state to disk.
*
* @param cls closure, unused
- * @param tc scheduler context, unused
*/
static void
-do_stop_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_stop_task (void *cls)
{
kill_task = NULL;
do_shutdown = GNUNET_YES;
if (NULL != publish_proc)
{
- GNUNET_OS_process_kill (publish_proc,
+ GNUNET_OS_process_kill (publish_proc,
SIGKILL);
return;
}
* process died).
*
* @param cls the `struct WorkItem` we were working on
- * @param tc context
*/
static void
-maint_child_death (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+maint_child_death (void *cls)
{
struct WorkItem *wi = cls;
struct GNUNET_HashCode key;
int ret;
char c;
const struct GNUNET_DISK_FileHandle *pr;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
run_task = NULL;
pr = GNUNET_DISK_pipe_handle (sigpipe,
GNUNET_DISK_PIPE_END_READ);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
{
/* shutdown scheduled us, someone else will kill child,
{
/* process still running? Then where did the SIGCHLD come from?
Well, let's declare it spurious (kernel bug?) and keep rolling.
- */
+ */
GNUNET_break (0);
run_task =
GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
return;
}
GNUNET_assert (GNUNET_OK == ret);
-
+
GNUNET_OS_process_destroy (publish_proc);
publish_proc = NULL;
* Function called to process work items.
*
* @param cls closure, NULL
- * @param tc scheduler context (unused)
*/
static void
-work (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+work (void *cls)
{
static char *argv[14];
static char anon_level[20];
NULL);
return;
}
- pr = GNUNET_DISK_pipe_handle (sigpipe,
+ pr = GNUNET_DISK_pipe_handle (sigpipe,
GNUNET_DISK_PIPE_END_READ);
run_task =
GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
if (0 != STAT (filename, &sbuf))
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
- "stat",
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
+ "stat",
filename);
return GNUNET_OK;
}
- GNUNET_CRYPTO_hash (filename,
- strlen (filename),
+ GNUNET_CRYPTO_hash (filename,
+ strlen (filename),
&fx[0]);
if (!S_ISDIR (sbuf.st_mode))
{
fattr[0] = GNUNET_htonll (sbuf.st_size);
fattr[0] = GNUNET_htonll (sbuf.st_mtime);
- GNUNET_CRYPTO_hash (fattr,
- sizeof (fattr),
+ GNUNET_CRYPTO_hash (fattr,
+ sizeof (fattr),
&fx[1]);
}
else
}
/* use hash here to make hierarchical structure distinct from
all files on the same level */
- GNUNET_CRYPTO_hash (fx,
+ GNUNET_CRYPTO_hash (fx,
sizeof (fx),
&ft);
/* use XOR here so that order of the files in the directory
* Periodically run task to update our view of the directory to share.
*
* @param cls NULL
- * @param tc scheduler context, unused
*/
static void
-scan (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+scan (void *cls)
{
run_task = NULL;
start_time = GNUNET_TIME_absolute_get ();
}
else
{
- run_task = GNUNET_SCHEDULER_add_now (&work,
+ run_task = GNUNET_SCHEDULER_add_now (&work,
NULL);
}
}
* @param c configuration
*/
static void
-run (void *cls,
- char *const *args,
+run (void *cls,
+ char *const *args,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
/* check arguments */
- if ( (NULL == args[0]) ||
+ if ( (NULL == args[0]) ||
(NULL != args[1]) ||
- (GNUNET_YES !=
+ (GNUNET_YES !=
GNUNET_DISK_directory_test (args[0],
GNUNET_YES)) )
{
cfg_filename = GNUNET_strdup (cfgfile);
cfg = c;
dir_name = args[0];
- work_finished = GNUNET_CONTAINER_multihashmap_create (1024,
+ work_finished = GNUNET_CONTAINER_multihashmap_create (1024,
GNUNET_NO);
load_state ();
run_task = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
- &scan,
+ &scan,
NULL);
kill_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&do_stop_task,
NULL);
}
int ok;
struct GNUNET_SIGNAL_Context *shc_chld;
- if (GNUNET_OK !=
+ if (GNUNET_OK !=
GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO,
+ sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO,
GNUNET_NO, GNUNET_NO);
GNUNET_assert (NULL != sigpipe);
shc_chld =
GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD,
&sighandler_child_death);
ok = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv,
+ GNUNET_PROGRAM_run (argc, argv,
"gnunet-auto-share [OPTIONS] FILENAME",
gettext_noop
("Automatically publish files from a directory on GNUnet"),
}
while (NULL != (wi = work_head))
{
- GNUNET_CONTAINER_DLL_remove (work_head,
+ GNUNET_CONTAINER_DLL_remove (work_head,
work_tail,
wi);
GNUNET_free (wi->filename);
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct Pattern *p;
* Task run when a publish operation should be stopped.
*
* @param cls the 'struct Pattern' of the publish operation to stop
- * @param tc unused
*/
static void
-publish_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+publish_stop_task (void *cls)
{
struct Pattern *p = cls;
* Task run when a download operation should be stopped.
*
* @param cls the 'struct Pattern' of the download operation to stop
- * @param tc unused
*/
static void
-download_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+download_stop_task (void *cls)
{
struct Pattern *p = cls;
* Task run when a download operation should be stopped.
*
* @param cls the 'struct Pattern' of the download operation to stop
- * @param tc unused
*/
static void
-search_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+search_stop_task (void *cls)
{
struct Pattern *p = cls;
* Start publish operation.
*
* @param cls the 'struct Pattern' specifying the operation to perform
- * @param tc scheduler context
*/
static void
-start_publish (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+start_publish (void *cls)
{
struct Pattern *p = cls;
struct GNUNET_FS_FileInformation *fi;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
p->task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
fi = make_file (p->x, p->y, p);
* Start download operation.
*
* @param cls the 'struct Pattern' specifying the operation to perform
- * @param tc scheduler context
*/
static void
-start_download (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+start_download (void *cls)
{
struct Pattern *p = cls;
struct GNUNET_FS_Uri *keywords;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
p->task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
keywords = make_keywords (p->x);
static void
-cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
GNUNET_FS_stop (ctx);
ctx = NULL;
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != dc)
{
* all statistics.
*
* @param cls NULL
- * @param tc unused
*/
static void
-terminate_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task (void *cls)
{
terminate_taskid = NULL;
GNUNET_TESTBED_get_statistics (0, NULL,
* FS state.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-do_stop_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_stop_task (void *cls)
{
struct GNUNET_FS_PublishContext *p;
static void
-clean_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+clean_task (void *cls)
{
size_t dsize;
void *ddata;
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (sc != NULL)
{
* Task that periodically ages our cover traffic statistics.
*
* @param cls unused closure
- * @param tc task context
*/
static void
-age_cover_counters (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+age_cover_counters (void *cls)
{
GSF_cover_content_count = (GSF_cover_content_count * 15) / 16;
GSF_cover_query_count = (GSF_cover_query_count * 15) / 16;
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GSF_cadet_stop_client ();
GSF_cadet_stop_server ();
(GNUNET_OK != main_init (server, cfg)))
{
GNUNET_SCHEDULER_shutdown ();
- shutdown_task (NULL, NULL);
+ shutdown_task (NULL);
return;
}
}
* Task called when it is time to destroy an inactive cadet channel.
*
* @param cls the `struct CadetHandle` to tear down
- * @param tc scheduler context, unused
*/
static void
-cadet_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cadet_timeout (void *cls)
{
struct CadetHandle *mh = cls;
struct GNUNET_CADET_Channel *tun;
* Task called when it is time to reset an cadet.
*
* @param cls the `struct CadetHandle` to tear down
- * @param tc scheduler context, unused
*/
static void
-reset_cadet_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reset_cadet_task (void *cls)
{
struct CadetHandle *mh = cls;
* Task run to asynchronously terminate the cadet due to timeout.
*
* @param cls the 'struct CadetClient'
- * @param tc scheduler context
*/
static void
-timeout_cadet_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_cadet_task (void *cls)
{
struct CadetClient *sc = cls;
struct GNUNET_CADET_Channel *tun;
static void
handle_datastore_reply (void *cls,
const struct GNUNET_HashCode *key,
- size_t size,
+ size_t size,
const void *data,
enum GNUNET_BLOCK_Type type,
uint32_t priority,
* (re)try to reserve bandwidth from the given peer.
*
* @param cls the `struct GSF_ConnectedPeer` to reserve from
- * @param tc scheduler context
*/
static void
-retry_reservation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+retry_reservation (void *cls)
{
struct GSF_ConnectedPeer *cp = cls;
struct GNUNET_PeerIdentity target;
* peer. Check, and if so, restart migration.
*
* @param cls the `struct GSF_ConnectedPeer`
- * @param tc scheduler context
*/
static void
-revive_migration (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+revive_migration (void *cls)
{
struct GSF_ConnectedPeer *cp = cls;
struct GNUNET_TIME_Relative bt;
* Free the given request.
*
* @param cls the request to free
- * @param tc task context
*/
static void
-peer_request_destroy (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+peer_request_destroy (void *cls)
{
struct PeerRequest *peerreq = cls;
struct GSF_PendingRequest *pr = peerreq->pr;
* The artificial delay is over, transmit the message now.
*
* @param cls the `struct GSF_DelayedHandle` with the message
- * @param tc scheduler context
*/
static void
-transmit_delayed_now (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_delayed_now (void *cls)
{
struct GSF_DelayedHandle *dh = cls;
struct GSF_ConnectedPeer *cp = dh->cp;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
GNUNET_CONTAINER_DLL_remove (cp->delayed_head,
cp->delayed_tail,
dh);
cp->delay_queue_size--;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
{
GNUNET_free (dh->pm);
* a transmission request.
*
* @param cls the `struct GSF_PeerTransmitHandle` of the request
- * @param tc scheduler context
*/
static void
-peer_transmit_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+peer_transmit_timeout (void *cls)
{
struct GSF_PeerTransmitHandle *pth = cls;
struct GSF_ConnectedPeer *cp;
* Call this method periodically to flush respect information to disk.
*
* @param cls closure, not used
- * @param tc task context, not used
*/
static void
-cron_flush_respect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cron_flush_respect (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
if (NULL == cp_map)
return;
GNUNET_CONTAINER_multipeermap_iterate (cp_map,
&flush_respect, NULL);
- if (NULL == tc)
- return;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_SCHEDULER_add_delayed_with_priority (RESPECT_FLUSH_FREQ,
void
GSF_connected_peer_done_ ()
{
- cron_flush_respect (NULL, NULL);
+ GNUNET_CONTAINER_multipeermap_iterate (cp_map,
+ &flush_respect,
+ NULL);
GNUNET_CONTAINER_multipeermap_iterate (cp_map,
&clean_peer, NULL);
GNUNET_CONTAINER_multipeermap_destroy (cp_map);
* Free the given client request.
*
* @param cls the client request to free
- * @param tc task context
*/
static void
-client_request_destroy (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+client_request_destroy (void *cls)
{
struct ClientRequest *cr = cls;
struct GSF_LocalClient *lc;
{
if (NULL != cr->kill_task)
GNUNET_SCHEDULER_cancel (cr->kill_task);
- client_request_destroy (cr, NULL);
+ client_request_destroy (cr);
}
while (NULL != (res = pos->res_head))
{
* Figure out when and how to transmit to the given peer.
*
* @param cls the `struct GSF_ConnectedPeer` for transmission
- * @param tc scheduler context
*/
static void
-schedule_peer_transmission (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+schedule_peer_transmission (void *cls);
/**
* Figure out when and how to transmit to the given peer.
*
* @param cls the `struct PeerPlan`
- * @param tc scheduler context
*/
static void
-schedule_peer_transmission (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_peer_transmission (void *cls)
{
struct PeerPlan *pp = cls;
struct GSF_RequestPlan *rp;
* Task that issues a warning if the datastore lookup takes too long.
*
* @param cls the `struct GSF_PendingRequest`
- * @param tc task context
*/
static void
-warn_delay_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+warn_delay_task (void *cls)
{
struct GSF_PendingRequest *pr = cls;
* Task that issues a warning if the datastore lookup takes too long.
*
* @param cls the `struct GSF_PendingRequest`
- * @param tc task context
*/
static void
-odc_warn_delay_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+odc_warn_delay_task (void *cls)
{
struct GSF_PendingRequest *pr = cls;
* migration
*
* @param cls unused
- * @param tc scheduler context (also unused)
*/
static void
-gather_migration_blocks (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+gather_migration_blocks (void *cls);
/**
* migration
*
* @param cls unused
- * @param tc scheduler context (also unused)
*/
static void
-gather_migration_blocks (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+gather_migration_blocks (void *cls)
{
mig_task = NULL;
if (mig_size >= MAX_MIGRATION_QUEUE)
* @param tc scheduler context (unused)
*/
static void
-gather_dht_put_blocks (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+gather_dht_put_blocks (void *cls);
/**
* Task that is run periodically to obtain blocks for DHT PUTs.
*
* @param cls type of blocks to gather
- * @param tc scheduler context
*/
static void
-delay_dht_put_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delay_dht_put_task (void *cls)
{
struct PutOperator *po = cls;
* Task that is run periodically to obtain blocks for DHT PUTs.
*
* @param cls type of blocks to gather
- * @param tc scheduler context (unused)
*/
static void
-gather_dht_put_blocks (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+gather_dht_put_blocks (void *cls)
{
struct PutOperator *po = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
po->dht_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
po->dht_qe =
static void
-cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
GNUNET_FS_stop (ctx);
ctx = NULL;
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct GNUNET_FS_UnindexContext *u;
static void
-do_report (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_report (void *cls)
{
char *fn = cls;
struct GNUNET_TIME_Relative del;
static void
-do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_report (void *cls)
{
static int download_counter;
const char *type = cls;
static void
-timeout_kill_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_kill_task (void *cls)
{
if (NULL != download)
{
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
if (NULL != publish)
{
static void
-stop_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+stop_fs_task (void *cls)
{
GNUNET_FS_stop (fs);
fs = NULL;
static void
-abort_download_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_download_task (void *cls)
{
uint64_t size;
static void
-timeout_kill_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_kill_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Timeout downloading file\n");
if (download != NULL)
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
if (publish != NULL)
{
static void
-abort_download_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_download_task (void *cls)
{
uint64_t size;
static void
-restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+restart_fs_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Restarting FS.\n");
GNUNET_FS_stop (fs);
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
GNUNET_FS_publish_stop (publish);
publish = NULL;
static void
-list_indexed_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+list_indexed_task (void *cls)
{
GNUNET_SCHEDULER_add_now (&abort_publish_task, NULL);
}
static void
-abort_ksk_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_ksk_search_task (void *cls)
{
if (ksk_search != NULL)
{
static void
-abort_sks_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_sks_search_task (void *cls)
{
if (sks_search == NULL)
return;
static void
-do_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_timeout (void *cls)
{
err = 1;
FPRINTF (stderr, "%s", "Operation timed out\n");
kill_task = NULL;
- abort_sks_search_task (NULL, tc);
- abort_ksk_search_task (NULL, tc);
+ abort_sks_search_task (NULL);
+ abort_ksk_search_task (NULL);
}
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
GNUNET_FS_publish_stop (publish);
publish = NULL;
static int err;
-static struct GNUNET_SCHEDULER_Task * rtask;
+static struct GNUNET_SCHEDULER_Task *rtask;
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
GNUNET_FS_publish_stop (publish);
publish = NULL;
static void
-restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+restart_fs_task (void *cls)
{
rtask = NULL;
GNUNET_FS_stop (fs);
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
if (NULL != publish)
{
static void
-abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_error (void *cls)
{
fprintf (stderr,
"Timeout\n");
static void
-abort_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_search_task (void *cls)
{
if (NULL != search)
{
static void
-abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_error (void *cls)
{
timeout_task = NULL;
fprintf (stderr,
err = 1;
}
+
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
if (NULL != publish)
{
static void
-abort_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_search_task (void *cls)
{
if (NULL != search)
{
static void
-restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+restart_fs_task (void *cls)
{
GNUNET_FS_stop (fs);
fs = GNUNET_FS_start (cfg, "test-fs-search-persistence", &progress_cb, NULL,
static void
-abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_error (void *cls)
{
timeout_task = NULL;
fprintf (stderr,
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
if (NULL != publish)
{
static void
-abort_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_search_task (void *cls)
{
if (search != NULL)
GNUNET_FS_search_stop (search);
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
if (NULL != publish)
{
static void
-abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_error (void *cls)
{
fprintf (stderr,
"Timeout\n");
static void
-abort_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_search_task (void *cls)
{
if (NULL != search)
{
static void
-do_stop (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_stop (void *cls)
{
char *fn = cls;
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
GNUNET_FS_publish_stop (publish);
publish = NULL;
static void
-abort_unindex_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_unindex_task (void *cls)
{
GNUNET_FS_unindex_stop (unindex);
unindex = NULL;
static void
-abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_publish_task (void *cls)
{
GNUNET_FS_publish_stop (publish);
publish = NULL;
static void
-abort_unindex_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+abort_unindex_task (void *cls)
{
if (unindex != NULL)
{
static void
-restart_fs_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+restart_fs_task (void *cls)
{
GNUNET_FS_stop (fs);
fs = GNUNET_FS_start (cfg, "test-fs-unindex-persistence", &progress_cb, NULL,
static void
-do_stop (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_stop (void *cls)
{
struct GNUNET_TIME_Relative del;
char *fancy;
static void
-stop_source_peer (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+stop_source_peer (void *cls)
{
struct DownloadContext *dc = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
/* Do not interact with testbed when shutting down */
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
static void
-do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_stop (void *cls)
{
char *fn = cls;
struct GNUNET_TIME_Relative del;
* Reconnect to GNS
*
* @param cls the handle
- * @param tc task context
*/
static void
-reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
struct GNUNET_GNS_Handle *handle = cls;
* and schedule the next run.
*/
static void
-run_daemon (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_daemon (void *cls)
{
struct MHD_Daemon *daemon_handle = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
http_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_assert (MHD_YES == MHD_run (daemon_handle));
* Stop HTTP server.
*/
static void
-server_stop (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+server_stop (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"HTTP server shutdown\n");
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != t4)
GNUNET_SCHEDULER_cancel (t4);
/**
* Task run on timeout. Cleans up request.
*
- * @param cls 'struct Request' of the request to clean up
- * @param tc scheduler context
+ * @param cls `struct Request *` of the request to clean up
*/
static void
-do_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_timeout (void *cls)
{
struct Request *request = cls;
* Task to read IPv4 DNS packets.
*
* @param cls the 'listen_socket4'
- * @param tc scheduler context
*/
static void
-read_dns4 (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+read_dns4 (void *cls)
{
struct sockaddr_in v4;
socklen_t addrlen;
ssize_t size;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
GNUNET_assert (listen_socket4 == cls);
t4 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
listen_socket4,
&read_dns4,
listen_socket4);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 == (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason))
return; /* shutdown? */
size = GNUNET_NETWORK_socket_recvfrom_amount (listen_socket4);
* Task to read IPv6 DNS packets.
*
* @param cls the 'listen_socket6'
- * @param tc scheduler context
*/
static void
-read_dns6 (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+read_dns6 (void *cls)
{
struct sockaddr_in6 v6;
socklen_t addrlen;
ssize_t size;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
GNUNET_assert (listen_socket6 == cls);
t6 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
listen_socket6,
&read_dns6,
listen_socket6);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 == (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason))
return; /* shutdown? */
size = GNUNET_NETWORK_socket_recvfrom_amount (listen_socket6);
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
struct request *rq;
if (NULL != id_op)
* Task run on shutdown.
*
* @param cls NULL
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_free_non_null (master_zone_pkey);
master_zone_pkey = NULL;
* from curl
*
* @param cls closure
- * @param tc task context
*/
static void
-curl_task_download (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+curl_task_download (void *cls);
/**
* Task that is run when we are ready to receive more data from curl.
*
* @param cls closure, NULL
- * @param tc task context
*/
static void
-curl_task_download (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+curl_task_download (void *cls)
{
int running;
int msgnum;
* Task run whenever HTTP server is idle for too long. Kill it.
*
* @param cls the `struct MhdHttpList *`
- * @param tc sched context
*/
static void
-kill_httpd_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+kill_httpd_task (void *cls)
{
struct MhdHttpList *hd = cls;
* Task run whenever HTTP server operations are pending.
*
* @param cls the `struct MhdHttpList *` of the daemon that is being run
- * @param tc sched context
*/
static void
-do_httpd (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_httpd (void *cls);
/**
* Task run whenever HTTP server operations are pending.
*
* @param cls the `struct MhdHttpList` of the daemon that is being run
- * @param tc scheduler context
*/
static void
-do_httpd (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_httpd (void *cls)
{
struct MhdHttpList *hd = cls;
* the SOCKS5 handshake). Clean up.
*
* @param cls the `struct Socks5Request *`
- * @param tc sched context
*/
static void
-timeout_s5r_handshake (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_s5r_handshake (void *cls)
{
struct Socks5Request *s5r = cls;
* Write data from buffer to socks5 client, then continue with state machine.
*
* @param cls the closure with the `struct Socks5Request`
- * @param tc scheduler context
*/
static void
-do_write (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_write (void *cls)
{
struct Socks5Request *s5r = cls;
ssize_t len;
* Read data from incoming Socks5 connection
*
* @param cls the closure with the `struct Socks5Request`
- * @param tc the scheduler context
*/
static void
-do_s5r_read (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_s5r_read (void *cls)
{
struct Socks5Request *s5r = cls;
const struct Socks5ClientHelloMessage *c_hello;
const struct Socks5ClientRequestMessage *c_req;
ssize_t rlen;
size_t alen;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
s5r->rtask = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ( (NULL != tc->read_ready) &&
(GNUNET_NETWORK_fdset_isset (tc->read_ready, s5r->sock)) )
{
* @param tc the scheduler context
*/
static void
-do_accept (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_accept (void *cls)
{
struct GNUNET_NETWORK_Handle *lsock = cls;
struct GNUNET_NETWORK_Handle *s;
struct Socks5Request *s5r;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
if (lsock == lsock4)
ltask4 = NULL;
else
ltask6 = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
if (lsock == lsock4)
* Task run on shutdown
*
* @param cls closure
- * @param tc task context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Shutting down...\n");
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != el)
{
* @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct ClientLookupHandle *clh;
struct MonitorActivity *ma;
* Method called periodically that triggers iteration over authoritative records
*
* @param cls closure
- * @param tc task context
*/
static void
-publish_zone_dht_next (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+publish_zone_dht_next (void *cls)
{
zone_publish_task = NULL;
GNUNET_NAMESTORE_zone_iterator_next (namestore_iter);
* Periodically iterate over our zone and store everything in dht
*
* @param cls NULL
- * @param tc task context
*/
static void
-publish_zone_dht_start (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+publish_zone_dht_start (void *cls);
/**
* Periodically iterate over all zones and store everything in DHT
*
* @param cls NULL
- * @param tc task context
*/
static void
-publish_zone_dht_start (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+publish_zone_dht_start (void *cls)
{
zone_publish_task = NULL;
* Task scheduled to asynchronously fail a resolution.
*
* @param cls the 'struct GNS_ResolverHandle' of the resolution to fail
- * @param tc task context
*/
static void
-fail_resolution (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+fail_resolution (void *cls)
{
struct GNS_ResolverHandle *rh = cls;
* @param tc task context
*/
static void
-recursive_resolution (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+recursive_resolution (void *cls);
/**
* Task scheduled to continue with the resolution process.
*
* @param cls the `struct GNS_ResolverHandle` of the resolution
- * @param tc task context
*/
static void
-recursive_resolution (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+recursive_resolution (void *cls)
{
struct GNS_ResolverHandle *rh = cls;
* @param tc scheduler context
*/
static void
-do_error (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_error (void *cls)
{
struct LookupHandle *handle = cls;
- struct MHD_Response *resp = GNUNET_REST_create_json_response (NULL);
+ struct MHD_Response *resp;
+
+ resp = GNUNET_REST_create_json_response (NULL);
handle->proc (handle->proc_cls, resp, MHD_HTTP_BAD_REQUEST);
cleanup_handle (handle);
}
GNUNET_CONTAINER_multihashmap_contains (conndata_handle->url_param_map,
&key) )
{
- handle->type = GNUNET_GNSRECORD_typename_to_number
+ handle->type = GNUNET_GNSRECORD_typename_to_number
(GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map,
&key));
}
static void
-curl_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+curl_task (void *cls)
{
curl_task_id = NULL;
curl_main ();
}
static void
-start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+start_curl (void *cls)
{
GNUNET_asprintf (&url,
"http://%s:%d/hello_world",
curl_main ();
}
+
static void
-disco_ns (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+disco_ns (void* cls)
{
GNUNET_NAMESTORE_disconnect (namestore);
}
+
/**
* Callback invoked from the namestore service once record is
* created.
static void
-mhd_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+mhd_task (void *cls)
{
mhd_task_id = NULL;
MHD_run (mhd);
* the other services.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-cleaning_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleaning_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Hostlist daemon is shutting down\n");
* @param tc task context, unused
*/
static void
-task_download (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+task_download (void *cls);
/**
* server.
*
* @param cls closure, unused
- * @param tc task context, unused
*/
static void
-task_download (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+task_download (void *cls)
{
int running;
struct CURLMsg *msg;
CURLMcode mret;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
ti_download = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static void
-task_download_dispatcher (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+task_download_dispatcher (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
ti_download_dispatcher_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download is initiated...\n");
* this task again for a later time.
*/
static void
-task_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task_check (void *cls)
{
static int once;
struct GNUNET_TIME_Relative delay;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
ti_check_download = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
if (stats == NULL)
* This tasks sets hostlist testing to allowed after intervall between to testings is reached
*
* @param cls closure
- * @param tc TaskContext
*/
static void
-task_testing_intervall_reset (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+task_testing_intervall_reset (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
ti_testing_intervall_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
stat_testing_allowed = GNUNET_OK;
* Task that writes hostlist entries to a file on a regular base
*
* @param cls closure
- * @param tc TaskContext
*/
static void
-task_hostlist_saving (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task_hostlist_saving (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
ti_saving_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
save_hostlist_file (GNUNET_NO);
* and schedule the next run.
*
* @param cls the `struct MHD_Daemon` of the HTTP server to run
- * @param tc scheduler context
*/
static void
-run_daemon (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_daemon (void *cls)
{
struct MHD_Daemon *daemon_handle = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
if (daemon_handle == daemon_handle_v4)
hostlist_task_v4 = NULL;
else
hostlist_task_v6 = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_assert (MHD_YES == MHD_run (daemon_handle));
static void
-clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+clean_up (void *cls)
{
if (p1.th != NULL)
{
* Timeout, give up.
*/
static void
-timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_error (void *cls)
{
timeout_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Timeout trying to connect peers, test failed.\n");
- clean_up (NULL, tc);
+ clean_up (NULL);
}
static void
-waitpid_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+waitpid_task (void *cls)
{
struct PeerContext *p = cls;
* Try again to connect to transport service.
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
stop_arm (&p1);
stop_arm (&p2);
* Timeout, give up.
*/
static void
-timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_error (void *cls)
{
timeout_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_testcase ();
}
* Check the server statistics regularly
*/
static void
-check_statistics (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+check_statistics (void *cls)
{
char *stat;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
check_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_asprintf (&stat, gettext_noop ("# advertised URI `%s' downloaded"),
static void
-clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+clean_up (void *cls)
{
if (NULL != p1.ghh)
{
* Timeout, give up.
*/
static void
-timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_error (void *cls)
{
timeout_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Timeout trying to connect peers, test failed.\n");
- clean_up (NULL, tc);
+ clean_up (NULL);
}
static void
-waitpid_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+waitpid_task (void *cls)
{
struct PeerContext *p = cls;
* Try again to connect to transport service.
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
stop_arm (&p1);
stop_arm (&p2);
* LookupRequest
*/
struct GNUNET_GNS_LookupRequest *lookup_request;
-
+
/**
* Audience Key
*/
* removes deleted attributes and expiration times.
*
* @param cls the ego entry
- * @param tc task context
*/
static void
-handle_token_update (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+handle_token_update (void *cls)
{
char *token_metadata;
char *write_ptr;
attr->name,
attr->val_head->value);
}
- else
+ else
{
GNUNET_CRYPTO_hash (attr->name,
strlen (attr->name),
&key_hash);
//Check if attr still exists. omit of not
- if (GNUNET_NO !=
+ if (GNUNET_NO !=
GNUNET_CONTAINER_multihashmap_contains (ego_entry->attr_map,
&key_hash))
{
}
static void
-update_identities(void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+update_identities(void *cls);
/**
*
GNUNET_CONTAINER_multihashmap_clear (ego_entry->attr_map);
update_task = GNUNET_SCHEDULER_add_now (&update_identities,
ego_entry->next);
- return;
+ return;
}
//There should be only a single record for a token under a label
aud_key,
&token);
- label = GNUNET_strdup (lbl);
+ label = GNUNET_strdup (lbl);
rd_exp = token_record->expiration_time;
GNUNET_SCHEDULER_add_now (&handle_token_update, ego_entry);
* dirty, first update the attributes.
*
* @param cls the ego to update
- * param tc task context
- *
*/
static void
-update_identities(void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+update_identities(void *cls)
{
struct EgoEntry *next_ego = cls;
const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
* @param tc task context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Shutting down...\n");
{
struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage *erm;
uint16_t token_len = strlen (token) + 1;
- erm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage)
+ erm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage)
+ token_len);
erm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_EXCHANGE_RESULT);
- erm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage)
+ erm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage)
+ token_len);
erm->ticket_nonce = htonl (ticket_nonce);
memcpy (&erm[1], token, token_len);
struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage *irm;
char *tmp_str;
- irm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage)
+ irm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage)
+ strlen (label) + 1
+ strlen (ticket) + 1
+ strlen (token) + 1);
irm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ISSUE_RESULT);
- irm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage)
+ irm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage)
+ strlen (label) + 1
+ strlen (ticket) + 1
+ strlen (token) + 1);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n",
"Error serializing ticket\n");
cleanup_issue_handle (handle);
- GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
+ GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
return;
}
if (GNUNET_OK != token_to_string (handle->token,
"Error serializing token\n");
GNUNET_free (ticket_str);
cleanup_issue_handle (handle);
- GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
+ GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
return;
}
irm = create_issue_result_message (handle->label, ticket_str, token_str);
GNUNET_free (token_str);
}
+
/**
* Build a GNUid token for identity
+ *
+ * FIXME: doxygen is very wrong here!
+ *
* @param handle the handle
* @param ego_entry the ego to build the token for
* @param name name of the ego
* @return identifier string of token (label)
*/
static void
-sign_and_return_token (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sign_and_return_token (void *cls)
{
struct GNUNET_CRYPTO_EcdsaPublicKey pub_key;
struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
uint64_t exp_time;
size_t token_metadata_len;
- //Remote nonce
+ //Remote nonce
nonce_str = NULL;
GNUNET_asprintf (&nonce_str, "%lu", handle->nonce);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request nonce: %s\n", nonce_str);
token_add_attr_int (handle->token, "exp", exp_time);
token_add_attr (handle->token, "nonce", nonce_str);
- //Token in a serialized encrypted format
+ //Token in a serialized encrypted format
GNUNET_assert (token_serialize (handle->token,
&handle->iss_key,
&ecdhe_privkey,
static void
cleanup_exchange_handle (struct ExchangeHandle *handle)
{
- if (NULL != handle->ticket)
+ if (NULL != handle->ticket)
ticket_destroy (handle->ticket);
if (NULL != handle->token)
token_destroy (handle->token);
return;
}
- record_str =
+ record_str =
GNUNET_GNSRECORD_value_to_string (GNUNET_GNSRECORD_TYPE_ID_TOKEN,
rd->data,
rd->data_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
">>> No existing token found\n");
//Label
- rnd_key =
+ rnd_key =
GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG,
UINT64_MAX);
GNUNET_STRINGS_base64_encode ((char*)&rnd_key,
&handle->iss_key,
&attr_collect,
handle);
- return;
+ return;
}
//There should be only a single record for a token under a label
return;
}
ecdhe_privkey = *((struct GNUNET_CRYPTO_EcdhePrivateKey *)token_metadata_record->data);
- aud_key =
+ aud_key =
(struct GNUNET_CRYPTO_EcdsaPublicKey *)(token_metadata_record->data+sizeof(struct GNUNET_CRYPTO_EcdhePrivateKey));
tmp_scopes = GNUNET_strdup ((char*) aud_key+sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
}
im = (const struct GNUNET_IDENTITY_PROVIDER_IssueMessage *) message;
scopes = (const char *) &im[1];
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received ISSUE of `%s' from client\n",
- scope);
issue_handle = GNUNET_malloc (sizeof (struct IssueHandle));
issue_handle->attr_map = GNUNET_CONTAINER_multihashmap_create (5,
GNUNET_NO);
+ /* FIXME: check that scopes is 0-termianted, Out-of-bounds access
+ possible here!!! */
scopes_tmp = GNUNET_strdup (scopes);
scope = strtok(scopes_tmp, ",");
for (; NULL != scope; scope = strtok (NULL, ","))
* @param c configuration
*/
static void
-run (void *cls,
+run (void *cls,
struct GNUNET_SERVER_Handle *server,
const struct GNUNET_CONFIGURATION_Handle *c)
{
&list_ego,
NULL);
- if (GNUNET_OK ==
+ if (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_time (cfg,
"identity-provider",
"TOKEN_EXPIRATION_INTERVAL",
* Try again to connect to the service.
*
* @param cls handle to the service.
- * @param tc scheduler context
*/
static void
-reconnect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+reconnect (void *cls);
/**
str = NULL;
}
label_str = strtok (str, ",");
-
+
if (NULL == label_str)
{
GNUNET_free (str);
op->ex_cb (op->cls, &token, ticket_nonce);
GNUNET_free (op);
break;
-
+
default:
GNUNET_break (0);
reschedule_connect (h);
* Try again to connect to the service.
*
* @param cls handle to the identity provider service.
- * @param tc scheduler context
*/
static void
-reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect (void *cls)
{
struct GNUNET_IDENTITY_PROVIDER_Handle *h = cls;
* DLL
*/
struct EgoEntry *next;
-
+
/**
* DLL
*/
struct EgoEntry *prev;
-
+
/**
* Ego Identifier
*/
* Public key string
*/
char *keystring;
-
+
/**
* The Ego
*/
* Selected ego
*/
struct EgoEntry *ego_entry;
-
+
/**
* Ptr to current ego private key
*/
* Handle to the rest connection
*/
struct RestConnectionDataHandle *conndata_handle;
-
+
/**
* The processing state
*/
/**
* ID of a task associated with the resolution process.
*/
- struct GNUNET_SCHEDULER_Task * timeout_task;
-
+ struct GNUNET_SCHEDULER_Task * timeout_task;
+
/**
* The plugin result processor
*/
struct EgoEntry *ego_tmp;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Cleaning up\n");
- if (NULL != handle->resp_object)
+ if (NULL != handle->resp_object)
GNUNET_REST_jsonapi_object_delete (handle->resp_object);
if (NULL != handle->timeout_task)
GNUNET_SCHEDULER_cancel (handle->timeout_task);
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_error (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_error (void *cls)
{
struct RequestHandle *handle = cls;
struct MHD_Response *resp;
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_cleanup_handle_delayed (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_cleanup_handle_delayed (void *cls)
{
struct RequestHandle *handle = cls;
cleanup_handle(handle);
char *ticket_str;
char *token_str;
char *result_str;
-
+
if (NULL == ticket)
{
handle->emsg = GNUNET_strdup ("Error in token issue");
&aud_key,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
- //Remote nonce
+ //Remote nonce
nonce_str = NULL;
GNUNET_CRYPTO_hash (GNUNET_IDENTITY_TOKEN_REQUEST_NONCE,
strlen (GNUNET_IDENTITY_TOKEN_REQUEST_NONCE),
* Build a GNUid token for identity
*
* @param cls the request handle
- * @param tc task context
*/
static void
-return_token_list (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+return_token_list (void *cls)
{
char* result_str;
struct RequestHandle *handle = cls;
char* token_str;
char* nonce_str;
uint64_t expected_nonce;
-
+
//Get nonce
GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_IDENTITY_PROVIDER_EXPECTED_NONCE,
strlen (GNUNET_REST_JSONAPI_IDENTITY_PROVIDER_EXPECTED_NONCE),
GNUNET_free (result);
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
cleanup_handle (handle);
- json_decref (root);
+ json_decref (root);
}
if (ID_REST_STATE_INIT == handle->state) {
ego_entry = GNUNET_new (struct EgoEntry);
GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
- ego_entry->keystring =
+ ego_entry->keystring =
GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
ego_entry->ego = ego;
GNUNET_asprintf (&ego_entry->identifier, "%s", identifier);
* Task run on shutdown.
*
* @param cls NULL
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != set_op)
{
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct Ego *e;
* Try again to connect to the identity service.
*
* @param cls handle to the identity service.
- * @param tc scheduler context
*/
static void
-reconnect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+reconnect (void *cls);
/**
* Try again to connect to the identity service.
*
* @param cls handle to the identity service.
- * @param tc scheduler context
*/
static void
-reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect (void *cls)
{
struct GNUNET_IDENTITY_Handle *h = cls;
struct GNUNET_IDENTITY_Operation *op;
* DLL
*/
struct EgoEntry *next;
-
+
/**
* DLL
*/
struct EgoEntry *prev;
-
+
/**
* Ego Identifier
*/
* Public key string
*/
char *keystring;
-
+
/**
* The Ego
*/
* Handle to the rest connection
*/
struct RestConnectionDataHandle *conndata_handle;
-
+
/**
* The processing state
*/
/**
* ID of a task associated with the resolution process.
*/
- struct GNUNET_SCHEDULER_Task * timeout_task;
+ struct GNUNET_SCHEDULER_Task * timeout_task;
/**
* The plugin result processor
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_error (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_error (void *cls)
{
struct RequestHandle *handle = cls;
struct MHD_Response *resp;
egoname_json = GNUNET_REST_jsonapi_resource_read_attr (json_res, GNUNET_REST_JSONAPI_IDENTITY_NAME);
if (!json_is_string (egoname_json))
{
- GNUNET_REST_jsonapi_object_delete (json_obj);
+ GNUNET_REST_jsonapi_object_delete (json_obj);
handle->emsg = GNUNET_strdup ("No name provided");
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
* @param url the url that is requested
* @param cls the RequestHandle
*/
-static void
+static void
ego_edit_cont (struct RestConnectionDataHandle *con,
const char *url,
void *cls)
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- json_res = GNUNET_REST_jsonapi_object_get_resource (json_obj, 0);
+ json_res = GNUNET_REST_jsonapi_object_get_resource (json_obj, 0);
if (GNUNET_NO == GNUNET_REST_jsonapi_resource_check_type (json_res, GNUNET_REST_JSONAPI_IDENTITY_EGO))
{
GNUNET_SCHEDULER_add_now (&do_error, handle);
}
-void
+void
ego_delete_cont (struct RestConnectionDataHandle *con_handle,
const char* url,
void *cls)
if (ID_REST_STATE_INIT == handle->state) {
ego_entry = GNUNET_new (struct EgoEntry);
GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
- ego_entry->keystring =
+ ego_entry->keystring =
GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
ego_entry->ego = ego;
GNUNET_asprintf (&ego_entry->identifier, "%s", identifier);
* Termiante the testcase (failure).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
cleanup ();
res = 1;
* Termiante the testcase (success).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_normally (void *cls)
{
cleanup ();
res = 0;
* Termiante the testcase (failure).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
cleanup ();
res = 1;
* Termiante the testcase (success).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_normally (void *cls)
{
cleanup ();
res = 0;
* variable) and raise those signals.
*
* @param cls closure (unused)
- * @param tc scheduler context (unused)
*/
void
-GNUNET_OS_install_parent_control_handler (void *cls,
- const struct
- GNUNET_SCHEDULER_TaskContext *tc);
+GNUNET_OS_install_parent_control_handler (void *cls);
/**
/*
This file is part of GNUnet
- Copyright (C) 2009-2015 GNUnet e.V.
+ Copyright (C) 2009-2016 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
* @param tc context information (why was this task triggered now)
*/
typedef void
-(*GNUNET_SCHEDULER_TaskCallback) (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+(*GNUNET_SCHEDULER_TaskCallback) (void *cls);
/**
/**
- * Obtain the reason code for why the current task was
- * started. Will return the same value as
- * the GNUNET_SCHEDULER_TaskContext's reason field.
+ * Obtain the reasoning why the current task was
+ * started.
*
- * @return reason(s) why the current task is run
+ * @return task context with information why the current task is run
*/
-enum GNUNET_SCHEDULER_Reason
-GNUNET_SCHEDULER_get_reason (void);
+const struct GNUNET_SCHEDULER_TaskContext *
+GNUNET_SCHEDULER_get_task_context (void);
/**
* @param client identification of the client; NULL
* for the last call when the server is destroyed
*/
-typedef void (*GNUNET_SERVER_DisconnectCallback) (void *cls,
- struct GNUNET_SERVER_Client *client);
+typedef void
+(*GNUNET_SERVER_DisconnectCallback) (void *cls,
+ struct GNUNET_SERVER_Client *client);
/**
* @param cls closure
* @param client identification of the client
*/
-typedef void (*GNUNET_SERVER_ConnectCallback) (void *cls,
- struct GNUNET_SERVER_Client *client);
+typedef void
+(*GNUNET_SERVER_ConnectCallback) (void *cls,
+ struct GNUNET_SERVER_Client *client);
/**
* @param client handle to client the tokenzier will be used for
* @return handle to custom tokenizer ('mst')
*/
-typedef void* (*GNUNET_SERVER_MstCreateCallback) (void *cls,
- struct GNUNET_SERVER_Client *client);
+typedef void*
+(*GNUNET_SERVER_MstCreateCallback) (void *cls,
+ struct GNUNET_SERVER_Client *client);
/**
* @param cls closure from #GNUNET_SERVER_set_callbacks
* @param mst custom tokenizer handle
*/
-typedef void (*GNUNET_SERVER_MstDestroyCallback) (void *cls, void *mst);
+typedef void
+(*GNUNET_SERVER_MstDestroyCallback) (void *cls,
+ void *mst);
/**
* #GNUNET_NO if one_shot was set and we have another message ready
* #GNUNET_SYSERR if the data stream is corrupt
*/
-typedef int (*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst,
- struct GNUNET_SERVER_Client *client,
- const char *buf, size_t size,
- int purge, int one_shot);
+typedef int
+(*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst,
+ struct GNUNET_SERVER_Client *client,
+ const char *buf,
+ size_t size,
+ int purge,
+ int one_shot);
/**
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != core)
{
* Terminate the test case (failure).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
res = 1;
cleanup ();
* Terminate the test case (success).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_normally (void *cls)
{
res = 0;
cleanup ();
}
-void
-tmit_resume (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+static void
+tmit_resume (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission resumed.\n");
struct TransmitClosure *tmit = cls;
static void
-schedule_origin_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_origin_stop (void *cls)
{
test = TEST_ORIGIN_STOP;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
static void
-schedule_member_part (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_member_part (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Test #%u: schedule_member_part()\n", test);
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != qe)
{
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
struct NamecacheClient *nc;
}
/* end of gnunet-service-namecache.c */
-
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-reconnect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
struct GNUNET_NAMECACHE_Handle *h = cls;
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != nsqe)
{
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
cleanup ();
res = 0;
* Task run whenever HTTP server operations are pending.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_httpd (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_httpd (void *cls);
/**
* Task run whenever HTTP server operations are pending.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_httpd (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_httpd (void *cls)
{
httpd_task = NULL;
MHD_run (httpd);
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != httpd_task)
{
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != get_default)
{
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
struct ZoneIteration *no;
struct NamestoreClient *nc;
* Obtain the next datum during the zone monitor's zone intiial iteration.
*
* @param cls zone monitor that does its initial iteration
- * @param tc scheduler context
*/
static void
-monitor_next (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+monitor_next (void *cls);
/**
* Obtain the next datum during the zone monitor's zone intiial iteration.
*
* @param cls zone monitor that does its initial iteration
- * @param tc scheduler context
*/
static void
-monitor_next (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+monitor_next (void *cls)
{
struct ZoneMonitor *zm = cls;
int ret;
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-reconnect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
struct GNUNET_NAMESTORE_Handle *h = cls;
* DLL
*/
struct RecordEntry *next;
-
+
/**
* DLL
*/
struct RecordEntry *prev;
-
+
};
struct RequestHandle
* JSON response object
*/
struct JsonApiObject *resp_object;
-
+
/**
* Rest connection
*/
struct RestConnectionDataHandle *conndata_handle;
-
+
/**
* Handle to GNS service.
*/
* Handle to NAMESTORE
*/
struct GNUNET_NAMESTORE_Handle *ns_handle;
-
+
/**
* Handle to NAMESTORE it
*/
struct GNUNET_NAMESTORE_ZoneIterator *list_it;
-
+
/**
* Private key for the zone
*/
/**
* ID of a task associated with the resolution process.
*/
- struct GNUNET_SCHEDULER_Task * timeout_task;
+ struct GNUNET_SCHEDULER_Task * timeout_task;
/**
* The plugin result processor
* Task run on shutdown. Cleans up everything.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-do_error (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_error (void *cls)
{
struct RequestHandle *handle = cls;
struct MHD_Response *resp = GNUNET_REST_create_json_response (NULL);
+
handle->proc (handle->proc_cls, resp, MHD_HTTP_BAD_REQUEST);
cleanup_handle (handle);
}
+
static void
-cleanup_handle_delayed (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_handle_delayed (void *cls)
{
cleanup_handle (cls);
}
+
/**
* Create a response with requested records
*
{
(*rd)[i].expiration_time = etime_abs.abs_value_us;
}
- else
+ else
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Value `%s' invalid for record type `%s'\n"),
value, typestring);
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Name property is no string\n");
- GNUNET_REST_jsonapi_object_delete (json_obj);
+ GNUNET_REST_jsonapi_object_delete (json_obj);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_NAMESTORE_ZKEY,
strlen (GNUNET_REST_JSONAPI_NAMESTORE_ZKEY),
&key);
- if ( GNUNET_NO ==
+ if ( GNUNET_NO ==
GNUNET_CONTAINER_multihashmap_contains (handle->conndata_handle->url_param_map,
&key) )
{
GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_NAMESTORE_EGO,
strlen (GNUNET_REST_JSONAPI_NAMESTORE_EGO),
&key);
- if ( GNUNET_YES ==
+ if ( GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_contains (handle->conndata_handle->url_param_map,
&key) )
{
GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_NAMESTORE_RECORD_TYPE,
strlen (GNUNET_REST_JSONAPI_NAMESTORE_RECORD_TYPE),
&key);
- if ( GNUNET_YES ==
+ if ( GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_contains (handle->conndata_handle->url_param_map,
&key) )
{
* @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != nsqe)
{
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
cleanup ();
res = 0;
}
-void lookup_it (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
- const char *label,
- unsigned int rd_count,
- const struct GNUNET_GNSRECORD_Data *rd)
+
+static void
+lookup_it (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+ const char *label,
+ unsigned int rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
nsqe = NULL;
int c;
* @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != nsqe)
{
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
cleanup ();
res = 0;
}
-void lookup_it (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
- const char *label,
- unsigned int rd_count,
- const struct GNUNET_GNSRECORD_Data *rd)
+
+static void
+lookup_it (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+ const char *label,
+ unsigned int rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
nsqe = NULL;
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != nsqe)
{
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
cleanup ();
res = 0;
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != nsqe)
{
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
cleanup ();
res = 0;
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != delayed_lookup_task)
{
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
cleanup ();
res = 0;
&pubkey, TEST_NAME, &rd_decrypt_cb, expected_rd));
}
+
static void
-name_lookup_shadow (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+name_lookup_shadow (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Performing lookup for shadow record \n");
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
do_shutdown ();
res = 1;
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
do_shutdown ();
res = 0;
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
do_shutdown ();
res = 1;
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
do_shutdown ();
res = 0;
unsigned int rd_count,
const struct GNUNET_GNSRECORD_Data *rd)
{
- static int returned_records;
- static int fail = GNUNET_NO;
+ static int returned_records;
+ static int fail = GNUNET_NO;
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Comparing results name %s\n",
name);
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != nsqe)
{
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
cleanup ();
res = 0;
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != nsqe)
{
static void
-end (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
cleanup ();
res = 0;
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != nsqe)
{
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
cleanup ();
res = 0;
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != nsqe)
{
static void
-end (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
cleanup ();
res = 0;
* @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != zi)
{
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
if (NULL != zi)
{
* @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (NULL != zi)
{
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
if (NULL != zi)
{
* @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
- if (NULL != zi)
- {
- GNUNET_NAMESTORE_zone_iteration_stop (zi);
- zi = NULL;
- }
-
+ if (NULL != zi)
+ {
+ GNUNET_NAMESTORE_zone_iteration_stop (zi);
+ zi = NULL;
+ }
if (nsh != NULL)
GNUNET_NAMESTORE_disconnect (nsh);
nsh = NULL;
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
- if (NULL != zi)
- {
- GNUNET_NAMESTORE_zone_iteration_stop (zi);
- zi = NULL;
- }
+ if (NULL != zi)
+ {
+ GNUNET_NAMESTORE_zone_iteration_stop (zi);
+ zi = NULL;
+ }
if (endbadly_task != NULL)
{
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
- if (NULL != zi)
- {
- GNUNET_NAMESTORE_zone_iteration_stop (zi);
- zi = NULL;
- }
+ if (NULL != zi)
+ {
+ GNUNET_NAMESTORE_zone_iteration_stop (zi);
+ zi = NULL;
+ }
if (nsh != NULL)
GNUNET_NAMESTORE_disconnect (nsh);
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
if (NULL != zi)
- {
- GNUNET_NAMESTORE_zone_iteration_stop (zi);
- zi = NULL;
- }
+ {
+ GNUNET_NAMESTORE_zone_iteration_stop (zi);
+ zi = NULL;
+ }
if (endbadly_task != NULL)
{
* Re-establish the connection to the service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+endbadly (void *cls)
{
if (nsh != NULL)
GNUNET_NAMESTORE_disconnect (nsh);
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
if (endbadly_task != NULL)
{
* (or once we failed to connect...).
*
* @param cls the 'struct TcpContext'
- * @param tc scheduler context
*/
static void
-tcp_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+tcp_send (void *cls)
{
struct TcpContext *ctx = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((NULL != tc->write_ready) &&
(GNUNET_NETWORK_fdset_isset (tc->write_ready, ctx->s)))
{
* Task run during shutdown.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_SERVER_destroy (server);
server = NULL;
* Call task to process STUN
*
* @param cls handle to NAT
- * @param tc TaskContext
*/
static void
-process_stun (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+process_stun (void *cls);
/**
* get DynDNS-IP addresses.
*
* @param cls the NAT handle
- * @param tc scheduler context
*/
static void
-resolve_dns (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+resolve_dns (void *cls);
/**
* Task to do a lookup on our hostname for IP addresses.
*
* @param cls the NAT handle
- * @param tc scheduler context
*/
static void
-resolve_hostname (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+resolve_hostname (void *cls);
/**
* after a certain delay.
*
* @param cls the `struct GNUNET_NAT_Handle`
- * @param tc scheduler context
*/
static void
-restart_nat_server (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+restart_nat_server (void *cls)
{
struct GNUNET_NAT_Handle *h = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
h->server_read_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
start_gnunet_nat_server (h);
* function to be called again once more is available.
*
* @param cls the NAT handle
- * @param tc the scheduling context
*/
static void
-nat_server_read (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+nat_server_read (void *cls)
{
struct GNUNET_NAT_Handle *h = cls;
char mybuf[40];
int port;
const char *port_start;
struct sockaddr_in sin_addr;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
h->server_read_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
memset (mybuf, 0, sizeof (mybuf));
* Task to scan the local network interfaces for IP addresses.
*
* @param cls the NAT handle
- * @param tc scheduler context
*/
static void
-list_interfaces (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+list_interfaces (void *cls)
{
struct GNUNET_NAT_Handle *h = cls;
* Task to do a STUN request
*
* @param cls the NAT handle
- * @param tc scheduler context
*/
static void
-process_stun (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+process_stun (void *cls)
{
struct GNUNET_NAT_Handle *h = cls;
struct StunServerList* elem = h->actual_stun_server;
* Task to do a lookup on our hostname for IP addresses.
*
* @param cls the NAT handle
- * @param tc scheduler context
*/
static void
-resolve_hostname (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+resolve_hostname (void *cls)
{
struct GNUNET_NAT_Handle *h = cls;
* get DynDNS-IP addresses.
*
* @param cls the NAT handle
- * @param tc scheduler context
*/
static void
-resolve_dns (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+resolve_dns (void *cls)
{
struct GNUNET_NAT_Handle *h = cls;
struct LocalAddressList *pos;
* incoming connection.
*
* @param cls
- * @param tc scheduler context
*/
static void
-do_udp_read (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_udp_read (void *cls)
{
struct GNUNET_NAT_AutoHandle *ah = cls;
unsigned char reply_buf[1024];
ssize_t rlen;
struct sockaddr_in answer;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) &&
(GNUNET_NETWORK_fdset_isset (tc->read_ready,
lsock4)))
* Main function for the connection reversal test.
*
* @param cls the `struct GNUNET_NAT_AutoHandle`
- * @param tc scheduler context
*/
static void
-reversal_test (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reversal_test (void *cls)
{
struct GNUNET_NAT_AutoHandle *ah = cls;
* address and call our callback.
*
* @param cls the `struct GNUNET_NAT_ExternalHandle`
- * @param tc scheduler context
*/
static void
-read_external_ipv4 (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+read_external_ipv4 (void *cls)
{
struct GNUNET_NAT_ExternalHandle *eh = cls;
ssize_t ret;
struct in_addr addr;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
eh->task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (GNUNET_YES == GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, eh->r))
ret =
GNUNET_DISK_file_read (eh->r, &eh->buf[eh->off],
* (Asynchronously) signal error invoking "external-ip" to client.
*
* @param cls the `struct GNUNET_NAT_ExternalHandle` (freed)
- * @param tc scheduler context
*/
static void
-signal_external_ip_error (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+signal_external_ip_error (void *cls)
{
struct GNUNET_NAT_ExternalHandle *eh = cls;
* Run "upnpc -l" to find out if our mapping changed.
*
* @param cls the `struct GNUNET_NAT_MiniHandle`
- * @param tc scheduler context
*/
static void
-do_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_refresh (void *cls);
/**
* Run "upnpc -l" to find out if our mapping changed.
*
* @param cls the 'struct GNUNET_NAT_MiniHandle'
- * @param tc scheduler context
*/
static void
-do_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_refresh (void *cls)
{
struct GNUNET_NAT_MiniHandle *mini = cls;
int ac;
* incoming connection.
*
* @param cls the `struct GNUNET_NAT_Test`
- * @param tc scheduler context
*/
static void
-do_udp_read (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_udp_read (void *cls)
{
struct GNUNET_NAT_Test *tst = cls;
uint16_t data;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
tst->ltask =
GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
tst->lsock,
* incoming connection.
*
* @param cls the `struct NatActivity`
- * @param tc scheduler context
*/
static void
-do_read (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_read (void *cls)
{
struct NatActivity *na = cls;
struct GNUNET_NAT_Test *tst;
uint16_t data;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
na->rtask = NULL;
tst = na->h;
GNUNET_CONTAINER_DLL_remove (tst->na_head, tst->na_tail, na);
* incoming connection.
*
* @param cls the `struct GNUNET_NAT_Test`
- * @param tc scheduler context
*/
static void
-do_accept (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_accept (void *cls)
{
struct GNUNET_NAT_Test *tst = cls;
struct GNUNET_NETWORK_Handle *s;
struct NatActivity *wl;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
tst->ltask = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
tst->ltask =
* Destroys the nat handle after the callback has been processed.
*
* @param cls handle to the timed out NAT test
- * @param tc not used
*/
static void
-do_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_timeout (void *cls)
{
struct GNUNET_NAT_Test *nh = cls;
nh->status = GNUNET_NAT_ERROR_SUCCESS;
if (0 == bnd_port)
{
- nh->nat
- = GNUNET_NAT_register (cfg, is_tcp, 0, 0,
+ nh->nat
+ = GNUNET_NAT_register (cfg, is_tcp, 0, 0,
NULL, NULL,
&addr_cb,
&reversal_cb, nh, NULL);
* Function that terminates the test.
*/
static void
-stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+stop (void *cls)
{
struct GNUNET_NAT_Handle *nat = cls;
* Function that terminates the test.
*/
static void
-stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+stop (void *cls)
{
struct GNUNET_NAT_MiniHandle *mini = cls;
static void
-failed_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+failed_timeout (void *cls)
{
tsk = NULL;
fprintf (stderr,
2),
&failed_timeout,
NULL);
-
+
}
"12345", NULL);
GNUNET_assert (NULL != gns);
GNUNET_PROGRAM_run (3, argv_prog,
- "test-nat-test", "nohelp",
+ "test-nat-test", "nohelp",
options, &run,
NULL);
GNUNET_break (0 == GNUNET_OS_process_kill (gns, GNUNET_TERM_SIG));
* incoming connection.
*
* @param cls
- * @param tc scheduler context
*/
static void
-do_udp_read (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_udp_read (void *cls)
{
//struct GNUNET_NAT_Test *tst = cls;
unsigned char reply_buf[1024];
ssize_t rlen;
struct sockaddr_in answer;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
ltask4 = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ( (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) ||
(! GNUNET_NETWORK_fdset_isset (tc->read_ready,
lsock4)) )
* Task run on shutdown; cleans up everything.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
shutdown_task_id = NULL;
if (GNUNET_YES == shutting_down)
* Task that starts/stops peers to move to the next round.
*
* @param cls NULL, unused
- * @param tc scheduler context (unused)
*/
static void
-next_round (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+next_round (void *cls);
/**
* the next round.
*
* @param cls unused, NULL
- * @param tc unused
*/
static void
-finish_round (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+finish_round (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
LOG (GNUNET_ERROR_TYPE_INFO, "Have %u connections\n", total_connections);
* peers; then get statistics from *all* peers.
*
* @param cls NULL, unused
- * @param tc unused
*/
static void
-next_round (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+next_round (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
LOG_DEBUG ("Disconnecting nse service of peers\n");
/**
* @file nse/gnunet-nse.c
* @brief Program to display network size estimates from the NSE service
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#include "platform.h"
* Task to shutdown and clean up all state
*
* @param cls NULL
- * @param tc the scheduler task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_task = NULL;
if (NULL != test)
static struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
-
+
status = 1;
if (GNUNET_OK !=
GNUNET_PROGRAM_run (argc, argv, "gnunet-nse",
* Task that triggers a NSE P2P transmission.
*
* @param cls the `struct NSEPeerEntry *`
- * @param tc scheduler context
*/
static void
-transmit_task_cb (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+transmit_task_cb (void *cls);
/**
* Task that triggers a NSE P2P transmission.
*
* @param cls the `struct NSEPeerEntry *`
- * @param tc scheduler context
*/
static void
-transmit_task_cb (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_task_cb (void *cls)
{
struct NSEPeerEntry *peer_entry = cls;
* Update our flood message to be sent (and our timestamps).
*
* @param cls unused
- * @param tc context for this message
*/
static void
-update_flood_message (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+update_flood_message (void *cls)
{
struct GNUNET_TIME_Relative offset;
unsigned int i;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
flood_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
offset = GNUNET_TIME_absolute_get_remaining (next_timestamp);
* Find our proof of work.
*
* @param cls closure (unused)
- * @param tc task context
*/
static void
-find_proof (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+find_proof (void *cls)
{
#define ROUND_SIZE 10
uint64_t counter;
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != flood_task)
{
* Try again to connect to network size estimation service.
*
* @param cls the handle to the transport service
- * @param tc scheduler context
*/
static void
-reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+reconnect (void *cls);
/**
* Try again to connect to network size estimation service.
*
* @param cls the `struct GNUNET_NSE_Handle *`
- * @param tc scheduler context
*/
static void
-reconnect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect (void *cls)
{
struct GNUNET_NSE_Handle *h = cls;
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_test (void *cls)
{
if (h != NULL)
{
* Task run on timeout to shut everything down.
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
unsigned int i;
* runs the next requested function.
*
* @param cls unused
- * @param tc unused
*/
static void
-state_machine (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+state_machine (void *cls);
/* ********************* 'get_info' ******************* */
* runs the next requested function.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct PrintContext *pc;
struct AddressRecord *ar;
* runs the next requested function.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-state_machine (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+state_machine (void *cls)
{
tt = NULL;
* Call this method periodically to scan data/hosts for new hosts.
*
* @param cls unused
- * @param tc scheduler context, aborted if reason is shutdown
*/
static void
-cron_scan_directory_data_hosts (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cron_scan_directory_data_hosts (void *cls)
{
static unsigned int retries;
struct DirScanContext dsc;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
if (GNUNET_SYSERR == GNUNET_DISK_directory_create (networkIdDirectory))
* HELLOs to expire.
*
* @param cls unused
- * @param tc scheduler context, aborted if reason is shutdown
*/
static void
-cron_clean_data_hosts (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cron_clean_data_hosts (void *cls)
{
struct GNUNET_TIME_Absolute now;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
now = GNUNET_TIME_absolute_get ();
* Clean up our state. Called during shutdown.
*
* @param cls unused
- * @param tc scheduler task context, unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct NotificationContext *cur;
struct NotificationContext *next;
* Task scheduled to re-try connecting to the peerinfo service.
*
* @param cls the `struct GNUNET_PEERINFO_Handle *`
- * @param tc scheduler context
*/
static void
-reconnect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
struct GNUNET_PEERINFO_Handle *h = cls;
* Peerinfo iteration request has timed out.
*
* @param cls the `struct GNUNET_PEERINFO_IteratorContext *`
- * @param tc scheduler context
*/
static void
-signal_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+signal_timeout (void *cls)
{
struct GNUNET_PEERINFO_IteratorContext *ic = cls;
GNUNET_PEERINFO_Processor cb;
/**
* Task to re-try connecting to peerinfo.
*
- * @param cls the 'struct GNUNET_PEERINFO_NotifyContext'
- * @param tc scheduler context
+ * @param cls the `struct GNUNET_PEERINFO_NotifyContext *`
*/
static void
-reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect (void *cls)
{
struct GNUNET_PEERINFO_NotifyContext *nc = cls;
if (msg == NULL)
{
GNUNET_CLIENT_disconnect (nc->client);
- reconnect (nc, NULL);
+ reconnect (nc);
return;
}
ms = ntohs (msg->size);
struct GNUNET_PeerIdentity pid;
-struct GNUNET_SCHEDULER_Task * timeout_task;
+struct GNUNET_SCHEDULER_Task *timeout_task;
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
timeout_task = NULL;
GNUNET_break(0);
global_ret = 255;
}
+
static void
-done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+done (void *cls)
{
if (NULL != pnc_w_fo)
GNUNET_PEERINFO_notify_cancel (pnc_w_fo);
/*
* Handle to PEERSTORE service
*/
-struct GNUNET_PEERSTORE_Handle *peerstore_handle;
+static struct GNUNET_PEERSTORE_Handle *peerstore_handle;
+
/**
* Run on shutdown
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != peerstore_handle)
{
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
in_shutdown = GNUNET_YES;
if (NULL == client_head) /* Only when no connected clients. */
* Deletes any expired records from storage
*/
static void
-cleanup_expired_records (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_expired_records (void *cls)
{
int ret;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_assert (NULL != db);
* Called when the iterate request is timedout
*
* @param cls a `struct GNUNET_PEERSTORE_IterateContext *`
- * @param tc Scheduler task context (unused)
*/
static void
-iterate_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+iterate_timeout (void *cls)
{
struct GNUNET_PEERSTORE_IterateContext *ic = cls;
GNUNET_PEERSTORE_Processor callback;
* @return #GNUNET_YES (all good, continue)
*/
static int
-iterate_cb (void *cls,
+iterate_cb (void *cls,
const struct GNUNET_PEERSTORE_Record *record,
const char *emsg)
{
GNUNET_break (NULL == emsg);
if (NULL == record)
{
- GNUNET_PEERSTORE_disconnect (h,
+ GNUNET_PEERSTORE_disconnect (h,
GNUNET_NO);
GNUNET_SCHEDULER_shutdown ();
return GNUNET_YES;
* data that should have been stored.
*
* @param cls NULL
- * @param tc unused
*/
static void
-test_cont (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+test_cont (void *cls)
{
h = GNUNET_PEERSTORE_connect (cfg);
- GNUNET_PEERSTORE_iterate (h,
- subsystem,
+ GNUNET_PEERSTORE_iterate (h,
+ subsystem,
&pid, key,
- GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_TIME_UNIT_FOREVER_REL,
&iterate_cb, NULL);
}
test1 ()
{
h = GNUNET_PEERSTORE_connect (cfg);
- GNUNET_PEERSTORE_store (h,
+ GNUNET_PEERSTORE_store (h,
subsystem,
- &pid,
- key,
+ &pid,
+ key,
val, strlen (val) + 1,
GNUNET_TIME_UNIT_FOREVER_ABS,
- GNUNET_PEERSTORE_STOREOPTION_REPLACE,
+ GNUNET_PEERSTORE_STOREOPTION_REPLACE,
NULL, NULL);
- GNUNET_PEERSTORE_disconnect (h,
+ GNUNET_PEERSTORE_disconnect (h,
GNUNET_YES);
h = NULL;
/* We need to wait a little bit to give the disconnect
* @param peer handle to our peer (unused)
*/
static void
-run (void *cls,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_TESTING_Peer *peer)
{
main (int argc, char *argv[])
{
if (0 !=
- GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync",
+ GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync",
"peerstore",
"test_peerstore_api_data.conf",
&run, NULL))
PGresult *result;
int ret;
struct GNUNET_CRYPTO_RsaPrivateKey *priv;
- char msg[] = "Hello";
+ const char msg[] = "hello";
void *msg2;
+ struct GNUNET_HashCode hmsg;
size_t msg2_len;
uint16_t u16;
uint16_t u162;
priv = GNUNET_CRYPTO_rsa_private_key_create (1024);
pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv);
- sig = GNUNET_CRYPTO_rsa_sign (priv,
- msg,
- sizeof (msg));
+ memset (&hmsg, 42, sizeof (hmsg));
+ sig = GNUNET_CRYPTO_rsa_sign_fdh (priv,
+ &hmsg);
u16 = 16;
u32 = 32;
u64 = 64;
static void
-schedule_transmit_message (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_transmit_message (void *cls)
{
struct Channel *chn = cls;
+
transmit_message (chn);
}
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != nc)
{
* Terminate the test case (failure).
*
* @param cls NULL
- * @param tc scheduler context
*/
-void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+static void
+end_badly (void *cls)
{
res = 1;
cleanup ();
* Terminate the test case (success).
*
* @param cls NULL
- * @param tc scheduler context
*/
-void
-end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+static void
+end_normally (void *cls)
{
res = 0;
cleanup ();
}
-void
-transmit_resume (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+static void
+transmit_resume (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission resumed.\n");
struct TransmitClosure *tmit = cls;
}
-void
-schedule_slave_part (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+static void
+schedule_slave_part (void *cls)
{
GNUNET_PSYC_slave_part (slv, GNUNET_NO, first_slave_parted, NULL);
}
mst_chn = GNUNET_PSYC_master_get_channel (mst);
}
-void
-schedule_master_start (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+
+static void
+schedule_master_start (void *cls)
{
master_start ();
}
-/*
+/**
* This file is part of GNUnet
* Copyright (C) 2013 GNUnet e.V.
*
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != nc)
{
* Try again to connect to the PSYCstore service.
*
* @param cls handle to the PSYCstore service.
- * @param tc scheduler context
*/
static void
-reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+reconnect (void *cls);
/**
* Try again to connect to the PSYCstore service.
*
* @param cls Handle to the PSYCstore service.
- * @param tc Scheduler context.
*/
static void
-reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect (void *cls)
{
struct GNUNET_PSYCSTORE_Handle *h = cls;
* Terminate the testcase (failure).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
res = 1;
cleanup ();
* Terminate the testcase (success).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_normally (void *cls)
{
res = 0;
cleanup ();
* Task run if the time to answer a DNS request via CADET is over.
*
* @param cls the `struct RequestContext` to abort
- * @param tc scheduler context
*/
static void
-timeout_request (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_request (void *cls)
{
struct RequestContext *rc = cls;
struct CadetExit *exit = rc->exit;
* Function scheduled as very last function, cleans up after us
*
* @param cls closure, NULL
- * @param tskctx scheduler context, unused
*/
static void
-cleanup (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tskctx)
+cleanup (void *cls)
{
struct CadetExit *exit;
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *c)
+do_shutdown (void *cls)
{
if (mhd_task_id != NULL)
{
static void
-curl_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+curl_task (void *cls)
{
curl_task_id = NULL;
curl_main ();
static void
-start_curl (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+start_curl (void *cls)
{
GNUNET_asprintf (&url,
"http://%s/hello_world",
static void
-disco_ns (void* cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+disco_ns (void* cls)
{
GNUNET_NAMESTORE_disconnect (namestore);
namestore = NULL;
static void
-mhd_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+mhd_task (void *cls)
{
mhd_task_id = NULL;
MHD_run (mhd);
* Function to run the HTTP client.
*/
static void
-curl_main (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+curl_main (void *cls)
{
fd_set rs;
fd_set ws;
static void
-mhd_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+mhd_task (void *cls)
{
mhd_task_id = NULL;
MHD_run (mhd);
static void
-ctrl_c_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+ctrl_c_shutdown (void *cls)
{
ctrl_c_task_id = NULL;
do_shutdown ();
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutting down\n");
* Announce a previously announced regex re-using cached data.
*
* @param cls Closure (regex to announce if needed).
- * @param tc TaskContext.
*/
static void
-reannounce_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reannounce_regex (void *cls)
{
- struct GNUNET_TIME_Relative random_delay;
char *regex = cls;
+ struct GNUNET_TIME_Relative random_delay;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
reannounce_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
GNUNET_free (regex);
* Start announcing the next regex in the DHT.
*
* @param cls Index of the next peer in the peers array.
- * @param tc TaskContext.
*/
static void
-announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+announce_next_regex (void *cls);
/******************************************************************************/
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
struct RegexPeer *peer;
unsigned int peer_cnt;
* abort task to run on test timed out
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
unsigned long i = (unsigned long) cls;
* profiler, when done.
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_collect_stats (void *cls)
{
struct RegexPeer *peer = &peers[0];
* Start searching for the next string in the DHT.
*
* @param cls Index of the next peer in the peers array.
- * @param tc TaskContext.
*/
static void
-find_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+find_string (void *cls);
/**
* specified timeout 'search_timeout'.
*
* @param cls NULL
- * @param tc the task context
*/
static void
-search_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
+search_timed_out (void *cls)
{
unsigned int i;
* but we should start another one.
*
* @param cls Index of the next peer in the peers array.
- * @param tc TaskContext.
*/
static void
-find_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+find_timed_out (void *cls)
{
struct RegexPeer *p = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
p->timeout = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
* Start searching for a string in the DHT.
*
* @param cls Index of the next peer in the peers array.
- * @param tc TaskContext.
*/
static void
-find_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+find_string (void *cls)
{
unsigned int search_peer = (unsigned int) (long) cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) ||
search_peer >= num_peers ||
GNUNET_YES == in_shutdown)
* @param tc the task context
*/
static void
-do_announce (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_announce (void *cls)
{
unsigned int i;
* Start announcing the next regex in the DHT.
*
* @param cls Closure (unused).
- * @param tc TaskContext.
*/
static void
-announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+announce_next_regex (void *cls)
{
struct RegexPeer *peer;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
if (next_search >= num_peers)
* Shutdown task.
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_task = NULL;
if (NULL != abort_task)
* abort task to run on test timed out
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Aborting\n");
abort_task = NULL;
* Iterate over files contained in policy_dir.
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_directory_scan (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_directory_scan (void *cls)
{
struct GNUNET_TIME_Absolute start_time;
struct GNUNET_TIME_Relative duration;
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-cleanup_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
struct ClientEntry *ce;
/**
* Periodic task to refresh our announcement of the regex.
*
- * @param cls the 'struct ClientEntry' of the client that triggered the
+ * @param cls the `struct ClientEntry *` of the client that triggered the
* announcement
- * @param tc scheduler context
*/
static void
-reannounce (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reannounce (void *cls)
{
struct ClientEntry *ce = cls;
static int ok = 1;
-static struct GNUNET_SCHEDULER_Task * die_task;
+static struct GNUNET_SCHEDULER_Task *die_task;
static void
-end (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
die_task = NULL;
GNUNET_REGEX_announce_cancel (a);
static void
-end (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
die_task = NULL;
GNUNET_REGEX_announce_cancel (a4);
end_badly ()
{
FPRINTF (stderr, "%s", "Testcase failed (timeout).\n");
- end (NULL, NULL);
+ end (NULL);
ok = 1;
}
static char* allow_headers;
/**
- * MHD Connection handle
+ * MHD Connection handle
*/
struct MhdConnectionHandle
{
* Task run whenever HTTP server operations are pending.
*
* @param cls NULL
- * @param tc sched context
*/
static void
-do_httpd (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_httpd (void *cls);
/**
struct MhdConnectionHandle *handle = cls;
handle->status = status;
handle->response = resp;
- run_mhd_now();
+ run_mhd_now();
}
struct RestConnectionDataHandle *handle = cls;
struct GNUNET_HashCode hkey;
char *val;
-
+
GNUNET_CRYPTO_hash (key, strlen (key), &hkey);
GNUNET_asprintf (&val, "%s", value);
if (GNUNET_OK !=
httpd = NULL;
}
if (NULL != httpd_task)
- {
+ {
GNUNET_SCHEDULER_cancel (httpd_task);
httpd_task = NULL;
}
* Task run whenever HTTP server is idle for too long. Kill it.
*
* @param cls NULL
- * @param tc sched context
*/
static void
-kill_httpd_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+kill_httpd_task (void *cls)
{
httpd_task = NULL;
kill_httpd ();
* Task run whenever HTTP server operations are pending.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-do_httpd (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_httpd (void *cls)
{
httpd_task = NULL;
MHD_run (httpd);
* @param tc the scheduler context
*/
static void
-do_accept (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_accept (void *cls)
{
struct GNUNET_NETWORK_Handle *lsock = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
struct GNUNET_NETWORK_Handle *s;
int fd;
const struct sockaddr *addr;
ltask4 = NULL;
else
ltask6 = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
- return;
+ return;
if (lsock == lsock4)
ltask4 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
lsock,
* Task run on shutdown
*
* @param cls closure
- * @param tc task context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Shutting down...\n");
sa4.sin_port = htons (port);
#if HAVE_SOCKADDR_IN_SIN_LEN
sa4.sin_len = sizeof (sa4);
-#endif
+#endif
ls = GNUNET_NETWORK_socket_create (AF_INET,
SOCK_STREAM,
0);
sa6.sin6_port = htons (port);
#if HAVE_SOCKADDR_IN_SIN_LEN
sa6.sin6_len = sizeof (sa6);
-#endif
+#endif
ls = GNUNET_NETWORK_socket_create (AF_INET6,
SOCK_STREAM,
0);
* @param c configuration
*/
static void
-run (void *cls,
- char *const *args,
+run (void *cls,
+ char *const *args,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
{
GNUNET_SCHEDULER_shutdown ();
return;
- }
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Service listens on port %u\n",
port);
* Function run if the user aborts with CTRL-C.
*
* @param cls closure
- * @param tc scheduler context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != el)
{
* Perform the proof-of-work calculation.
*
* @param cls the `struct RevocationData`
- * @param tc scheduler context
*/
static void
-calculate_pow (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+calculate_pow (void *cls)
{
struct RevocationData *rd = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
/* store temporary results */
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ( (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) ||
(0 == (rd->pow % 128) ) )
{
* run the set operation on the revocation certificates.
*
* @param cls NULL
- * @param tc scheduler context (unused)
*/
static void
-transmit_task_cb (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_task_cb (void *cls)
{
struct PeerEntry *peer_entry = cls;
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != revocation_set)
{
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
unsigned int c;
static void
-check_revocation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+check_revocation (void *cls);
static void
static void
-check_revocation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+check_revocation (void *cls)
{
GNUNET_REVOCATION_query (testpeers[0].cfg,
&testpeers[1].pubkey,
{
fprintf (stderr,
"Revocation successful\n");
- check_revocation (NULL, NULL);
+ check_revocation (NULL);
}
}
* Cancels pending request and disconnects.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-do_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_task = NULL;
if (NULL != req_handle)
static void
-do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_round (void *cls);
static void
-do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_mal_round (void *cls);
#ifdef ENABLE_MALICIOUS
* This is executed regylary.
*/
static void
-do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_mal_round (void *cls)
{
uint32_t num_pushes;
uint32_t i;
* This is executed regylary.
*/
static void
-do_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_round (void *cls)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round.\n");
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "RPS is going down\n");
* Sampler.
*/
typedef void
-(*RPS_get_peers_type) (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+(*RPS_get_peers_type) (void *cls);
/**
* Get one random peer out of the sampled peers.
* Only used internally
*/
static void
-sampler_get_rand_peer (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+sampler_get_rand_peer (void *cls);
+
/**
* Get one random peer out of the sampled peers.
* corrsponding peer to the client.
*/
static void
-sampler_mod_get_rand_peer (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+sampler_mod_get_rand_peer (void *cls);
/**
* Only used internally
*/
static void
-sampler_get_rand_peer (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sampler_get_rand_peer (void *cls)
{
struct GetPeerCls *gpc = cls;
uint32_t r_index;
struct RPS_Sampler *sampler;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
gpc->get_peer_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
sampler = gpc->req_handle->sampler;
* corrsponding peer to the client.
*/
static void
-sampler_mod_get_rand_peer (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sampler_mod_get_rand_peer (void *cls)
{
struct GetPeerCls *gpc = cls;
struct RPS_SamplerElement *s_elem;
struct GNUNET_TIME_Relative last_request_diff;
struct RPS_Sampler *sampler;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
gpc->get_peer_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
sampler = gpc->req_handle->sampler;
/**
- * Write the ids and their according index in the given array to a file
+ * Write the ids and their according index in the given array to a file
* Unused
*/
/* static void
* Task run on timeout to shut everything down.
*/
static void
-shutdown_op (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_op (void *cls)
{
unsigned int i;
/**
* Seed peers.
*/
- void
-seed_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+static void
+seed_peers (void *cls)
{
+ struct RPSPeer *peer = cls;
unsigned int amount;
- struct RPSPeer *peer = (struct RPSPeer *) cls;
unsigned int i;
// TODO if malicious don't seed mal peers
GNUNET_RPS_seed_ids (peer->rps_handle, amount, rps_peer_ids);
}
+
/**
* Seed peers.
*/
- void
-seed_peers_big (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+static void
+seed_peers_big (void *cls)
{
- struct RPSPeer *peer = (struct RPSPeer *) cls;
+ struct RPSPeer *peer = cls;
unsigned int seed_msg_size;
uint32_t num_peers_max;
unsigned int amount;
"[%s] got %" PRIu64 " peers:\n",
GNUNET_i2s (rps_peer->peer_id),
n);
-
+
for (i = 0; i < n; i++)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
* Request random peers.
*/
static void
-request_peers (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+request_peers (void *cls)
{
+ struct PendingRequest *pending_req = cls;
struct RPSPeer *rps_peer;
- struct PendingRequest *pending_req = (struct PendingRequest *) cls;
struct PendingReply *pending_rep;
if (GNUNET_YES == in_shutdown)
* Cancel a request.
*/
static void
-cancel_request_cb (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cancel_request_cb (void *cls)
{
+ struct RPSPeer *rps_peer = cls;
struct PendingReply *pending_rep;
- struct RPSPeer *rps_peer = (struct RPSPeer *) cls;
if (GNUNET_YES == in_shutdown)
return;
}
}
+
static void
-churn (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+churn (void *cls)
{
unsigned int i;
unsigned int j;
* @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
if (NULL != computation)
{
* @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Shutting down, initiating cleanup.\n");
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Shutting down, initiating cleanup.\n");
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Shutting down, initiating cleanup.\n");
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Shutting down, initiating cleanup.\n");
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-handle_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+handle_shutdown (void *cls)
{
in_shutdown = GNUNET_YES;
options, &run, NULL, GNUNET_YES);
return 0;
}
-
* @param tc unused
*/
static void
-cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
while (NULL != decrypt_sessions_head)
decrypt_session_destroy (decrypt_sessions_head);
GNUNET_SERVICE_run (argc, argv, "secretsharing",
GNUNET_SERVICE_OPTION_NONE, &run, NULL)) ? 0 : 1;
}
-
GNUNET_SCHEDULER_shutdown ();
}
+
static void
-handle_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext * tc)
+handle_shutdown (void *cls)
{
if (NULL != keygen)
{
}
}
+
static void
run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TESTING_Peer *peer)
{
- struct GNUNET_HashCode session_id;
+ struct GNUNET_HashCode session_id;
struct GNUNET_TIME_Absolute start;
struct GNUNET_TIME_Absolute deadline;
return ret;
return (GNUNET_YES == success) ? 0 : 1;
}
-
* @param tc context information (why was this task triggered now)
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
while (NULL != incoming_head)
incoming_destroy (incoming_head);
* @param tc context information (why was this task triggered now)
*/
static void
-incoming_timeout_cb (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+incoming_timeout_cb (void *cls)
{
struct Operation *incoming = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
incoming->timeout_task = NULL;
GNUNET_assert (GNUNET_YES == incoming->is_incoming);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static void
-handle_shutdown (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+handle_shutdown (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Shutting down set profiler\n");
options, &pre_run, NULL, GNUNET_YES);
return ret;
}
-
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Handling response to lazy copy\n");
-
+
GNUNET_CONTAINER_DLL_remove (set->copy_req_head,
set->copy_req_tail,
req);
-
+
// We pass none as operation here, since it doesn't matter when
// cloning.
new_set = create_internal (set->cfg, GNUNET_SET_OPERATION_NONE, &msg->cookie);
* Connect to the set service in order to listen for requests.
*
* @param cls the `struct GNUNET_SET_ListenHandle *` to connect
- * @param tc task context if invoked as a task, NULL otherwise
*/
static void
-listen_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+listen_connect (void *cls);
/**
* Connect to the set service in order to listen for requests.
*
* @param cls the `struct GNUNET_SET_ListenHandle *` to connect
- * @param tc task context if invoked as a task, NULL otherwise
*/
static void
-listen_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+listen_connect (void *cls)
{
static const struct GNUNET_MQ_MessageHandler mq_handlers[] = {
{ &handle_request, GNUNET_MESSAGE_TYPE_SET_REQUEST },
struct GNUNET_SET_ListenHandle *lh = cls;
struct GNUNET_MQ_Envelope *mqm;
struct GNUNET_SET_ListenMessage *msg;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
- if ( (NULL != tc) &&
- (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) )
+ tc = GNUNET_SCHEDULER_get_task_context ();
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Listener not reconnecting due to shutdown\n");
lh->operation = operation;
lh->app_id = *app_id;
lh->reconnect_backoff = GNUNET_TIME_UNIT_MILLISECONDS;
- listen_connect (lh, NULL);
+ listen_connect (lh);
if (NULL == lh->client)
{
GNUNET_free (lh);
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-timeout_fail (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_fail (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_SCHEDULER_shutdown ();
}
return ret;
}
-
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-timeout_fail (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_fail (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_SCHEDULER_shutdown ();
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context information (why was this task triggered now)
*/
static void
-timeout_fail (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_fail (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_SCHEDULER_shutdown ();
struct MessageTransmitQueue *tmit_msg);
-int
-place_entry_cleanup (void *cls, const struct GNUNET_HashCode *key, void *value)
+static int
+place_entry_cleanup (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
cleanup_place (value);
return GNUNET_YES;
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GNUNET_CONTAINER_multihashmap_iterate (hosts, place_entry_cleanup, NULL);
GNUNET_CONTAINER_multihashmap_iterate (guests, place_entry_cleanup, NULL);
static void
-schedule_cleanup_place (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_cleanup_place (void *cls)
{
cleanup_place (cls);
}
static void
-schedule_guest_leave (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+schedule_guest_leave (void *cls);
+
static void
host_answer_door (void *cls,
* Terminate the test case (failure).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
res = 1;
cleanup ();
* Terminate the test case (success).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_normally (void *cls)
{
res = 0;
cleanup ();
static void
-transmit_resume (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_resume (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission resumed.\n");
struct TransmitClosure *tmit = cls;
static void
-schedule_host_leave (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_host_leave (void *cls)
{
test = TEST_HOST_LEAVE;
GNUNET_SOCIAL_host_leave (hst, NULL, &host_left, NULL);
static void
-schedule_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_reconnect (void *cls)
{
test = TEST_RECONNECT;
static void
-schedule_guest_leave (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_guest_leave (void *cls)
{
guest_leave ();
}
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
in_shutdown = GNUNET_YES;
if (0 != client_count)
* Function run on shutdown to clean up.
*
* @param cls the statistics handle
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct GNUNET_STATISTICS_Handle *h = cls;
* @param tc schedueler context
*/
static void
-main_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+main_task (void *cls)
{
const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
struct GNUNET_STATISTICS_Handle *h;
* We've waited long enough, reconnect now.
*
* @param cls the `struct GNUNET_STATISTICS_Handle` to reconnect
- * @param tc scheduler context (unused)
*/
static void
-reconnect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
struct GNUNET_STATISTICS_Handle *h = cls;
* Task used by 'reconnect_later' to shutdown the handle
*
* @param cls the statistics handle
- * @param tc scheduler context
*/
static void
-do_destroy (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_destroy (void *cls)
{
struct GNUNET_STATISTICS_Handle *h = cls;
* Task used to destroy the statistics handle.
*
* @param cls the `struct GNUNET_STATISTICS_Handle`
- * @param tc the scheduler context
*/
static void
-destroy_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+destroy_task (void *cls)
{
struct GNUNET_STATISTICS_Handle *h = cls;
* call the continuation.
*
* @param cls the `struct GNUNET_STATISTICS_GetHandle`
- * @param tc scheduler context
*/
static void
-run_get_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_get_timeout (void *cls)
{
struct GNUNET_STATISTICS_GetHandle *gh = cls;
GNUNET_STATISTICS_Callback cont = gh->cont;
static struct GNUNET_STATISTICS_Handle *h2;
-static struct GNUNET_SCHEDULER_Task * shutdown_task;
+static struct GNUNET_SCHEDULER_Task *shutdown_task;
static void
-force_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+force_shutdown (void *cls)
{
fprintf (stderr, "Timeout, failed to receive notifications: %d\n", ok);
GNUNET_STATISTICS_destroy (h, GNUNET_NO);
static void
-normal_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+normal_shutdown (void *cls)
{
GNUNET_STATISTICS_destroy (h, GNUNET_NO);
GNUNET_STATISTICS_destroy (h2, GNUNET_NO);
static struct GNUNET_STATISTICS_Handle *h2;
-static struct GNUNET_SCHEDULER_Task * shutdown_task;
+static struct GNUNET_SCHEDULER_Task *shutdown_task;
static void
-force_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+force_shutdown (void *cls)
{
fprintf (stderr, "Timeout, failed to receive notifications: %d\n", ok);
GNUNET_STATISTICS_destroy (h, GNUNET_NO);
static void
-normal_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+normal_shutdown (void *cls)
{
GNUNET_STATISTICS_destroy (h, GNUNET_NO);
GNUNET_STATISTICS_destroy (h2, GNUNET_NO);
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
/* FIXME: do clean up here */
}
* Shutdown
*
* @param cls NULL
- * @param tc task context from scheduler
* @return
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_task = NULL;
GNUNET_ATS_performance_done (ats);
* Shutdown task to cleanup our resources and exit.
*
* @param cls NULL
- * @param tc scheduler task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
cleanup_map ();
if (NULL != bh)
* Shutdown task to cleanup our resources and exit.
*
* @param cls NULL
- * @param tc scheduler task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != transport)
{
* Task to shut down cleanly
*
* @param cls NULL
- * @param tc the task context
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
LOG_DEBUG ("Shutting down\n");
shutdown_task_id = NULL;
* Task to write to the standard out
*
* @param cls the WriteContext
- * @param tc the TaskContext
*/
static void
-write_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+write_task (void *cls)
{
struct WriteContext *wc = cls;
ssize_t bytes_wrote;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
GNUNET_assert (NULL != wc);
write_task_id = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
{
GNUNET_free (wc->data);
* process died).
*
* @param cls closure, NULL if we need to self-restart
- * @param tc context
*/
static void
-child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+child_death_task (void *cls)
{
const struct GNUNET_DISK_FileHandle *pr;
char c[16];
enum GNUNET_OS_ProcessStatusType type;
unsigned long code;
int ret;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
child_death_task_id = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
{
child_death_task_id =
* Task to read from stdin
*
* @param cls NULL
- * @param tc the task context
*/
static void
-read_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+read_task (void *cls)
{
char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
ssize_t sread;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
read_task_id = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
sread = GNUNET_DISK_file_read (stdin_fd, buf, sizeof (buf));
* Dummy task callback to keep us running forever
*
* @param cls NULL
- * @param tc scheduler task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != wh)
GNUNET_TESTBED_barrier_wait_cancel (wh);
* Task to wait for the barrier
*
* @param cls NULL
- * @param tc scheduler task context
* @return
*/
static void
-do_wait (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_wait (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
wh = GNUNET_TESTBED_barrier_wait (TEST_BARRIER_NAME, &barrier_wait_cb, NULL);
* Task to clean up and shutdown nicely
*
* @param cls NULL
- * @param tc the TaskContext from scheduler
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct MessageQueue *mq_entry;
* @param client identification of the client; NULL
* for the last call when the server is destroyed
*/
-static void
+static void
client_disconnected (void *cls, struct GNUNET_SERVER_Client *client)
{
if (NULL == client)
* Task to free resources when forwarded operation has been timedout
*
* @param cls the ForwardedOperationContext
- * @param tc the task context from scheduler
*/
void
-GST_forwarded_operation_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+GST_forwarded_operation_timeout (void *cls)
{
struct ForwardedOperationContext *fopc = cls;
* Task to clean up and shutdown nicely
*
* @param cls NULL
- * @param tc the TaskContext from scheduler
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct MessageQueue *mq_entry;
uint32_t id;
* @param tc the task context from scheduler
*/
void
-GST_forwarded_operation_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+GST_forwarded_operation_timeout (void *cls);
/**
* subcontrollers to barrier init message
*
* @param cls barrier
- * @param tc scheduler task context
*/
static void
-fwd_tout_barrier_init (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+fwd_tout_barrier_init (void *cls)
{
struct Barrier *barrier = cls;
* Expire a #PooledConnection object
*
* @param cls the #PooledConnection object
- * @param tc scheduler task context
*/
static void
-expire (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+expire (void *cls)
{
struct PooledConnection *entry = cls;
* further schedules itself if there are similar waiting objects which can be notified.
*
* @param cls the #PooledConnection object
- * @param tc the task context from scheduler
*/
static void
-connection_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+connection_ready (void *cls)
{
struct PooledConnection *entry = cls;
struct GST_ConnectionPool_GetHandle *gh;
static void
-sample_load_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+sample_load_task (void *cls)
{
struct GNUNET_TIME_Absolute now;
char *str;
int ld_disk;
unsigned int mem_usage;
unsigned int nproc;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
sample_load_task_id = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
ld_cpu = cpu_get_load ();
* The Link Controller forwarding task
*
* @param cls the LCFContext
- * @param tc the Task context from scheduler
*/
static void
-lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+lcf_proc_task (void *cls);
/**
* The Link Controller forwarding task
*
* @param cls the LCFContext
- * @param tc the Task context from scheduler
*/
static void
-lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+lcf_proc_task (void *cls);
/**
* Task to free resources when forwarded link controllers has been timedout
*
* @param cls the LCFContext
- * @param tc the task context from scheduler
*/
static void
-lcf_forwarded_operation_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+lcf_forwarded_operation_timeout (void *cls)
{
struct LCFContext *lcf = cls;
* The Link Controller forwarding task
*
* @param cls the LCFContext
- * @param tc the Task context from scheduler
*/
static void
-lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+lcf_proc_task (void *cls)
{
struct LCFContext *lcf = cls;
struct LCFContextQueue *lcfq;
* neighbour
*
* @param cls the neighbour
- * @param tc scheduler task context
*/
static void
-neighbour_connect_notify_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+neighbour_connect_notify_task (void *cls)
{
struct Neighbour *n = cls;
struct NeighbourConnectNotification *h;
* Task to be run upon timeout while attempting to connect to the neighbour
*
* @param cls the NeighbourConnectCtxt created in GST_handle_link_controllers()
- * @param tc the scheduler task context
*/
static void
-timeout_neighbour_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_neighbour_connect (void *cls)
{
struct NeighbourConnectCtxt *ncc = cls;
* Timeout task for cancelling a forwarded overlay connect connect
*
* @param cls the ForwardedOverlayConnectContext
- * @param tc the task context from the scheduler
*/
static void
-forwarded_overlay_connect_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext
- *tc)
+forwarded_overlay_connect_timeout (void *cls)
{
struct ForwardedOperationContext *fopc = cls;
struct RegisteredHostContext *rhc;
LOG_DEBUG ("Overlay linking between peers %u and %u failed\n", focc->peer1,
focc->peer2);
GST_cleanup_focc (focc);
- GST_forwarded_operation_timeout (fopc, tc);
+ GST_forwarded_operation_timeout (fopc);
if (NULL != rhc->focc_dll_head)
GST_process_next_focc (rhc);
}
* Task for cleaing up overlay connect context structure
*
* @param cls the overlay connect context
- * @param tc the task context
*/
static void
-do_cleanup_occ (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_cleanup_occ (void *cls)
{
struct OverlayConnectContext *occ = cls;
* Task which will be run when overlay connect request has been timed out
*
* @param cls the OverlayConnectContext
- * @param tc the TaskContext
*/
static void
-timeout_overlay_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_overlay_connect (void *cls)
{
struct OverlayConnectContext *occ = cls;
* peer 1.
*
* @param cls the OverlayConnectContext
- * @param tc the TaskContext from scheduler
*/
static void
-send_hello (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+send_hello (void *cls);
/**
- * Task that is run when hello has been sent
+ * Task that is run when hello has been sent If tc->reason =
+ * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
+ * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded
*
* @param cls the overlay connect context
- * @param tc the scheduler task context; if tc->reason =
- * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
- * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded
*/
static void
-occ_hello_sent_cb (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+occ_hello_sent_cb (void *cls)
{
struct OverlayConnectContext *occ = cls;
struct LocalPeer2Context *lp2c;
struct Peer *peer2;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
GNUNET_assert (OCC_TYPE_LOCAL == occ->type);
GNUNET_assert (NULL != occ->timeout_task);
lp2c = &occ->p2ctx.local;
* send_hello_thru_rocc()
*
* @param cls the OverlayConnectContext
- * @param tc the TaskContext from scheduler
*/
static void
-send_hello (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_hello (void *cls)
{
struct OverlayConnectContext *occ = cls;
struct LocalPeer2Context *lp2c;
char *other_peer_str;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
occ->send_hello_task = NULL;
GNUNET_assert (NULL != occ->timeout_task);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
GNUNET_assert (NULL != occ->hello);
* Task to timeout rocc and cleanit up
*
* @param cls the RemoteOverlayConnectCtx
- * @param tc the TaskContext from scheduler
*/
static void
-timeout_rocc_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_rocc_task (void *cls)
{
struct RemoteOverlayConnectCtx *rocc = cls;
* whose identity is in RemoteOverlayConnectCtx
*
* @param cls the RemoteOverlayConnectCtx
- * @param tc the TaskContext from scheduler
*/
static void
-attempt_connect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+attempt_connect_task (void *cls);
/**
- * Task that is run when hello has been sent
+ * Task that is run when hello has been sent If tc->reason =
+ * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
+ * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded
*
* @param cls the overlay connect context
- * @param tc the scheduler task context; if tc->reason =
- * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
- * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded
*/
static void
-rocc_hello_sent_cb (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+rocc_hello_sent_cb (void *cls)
{
struct RemoteOverlayConnectCtx *rocc = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
rocc->ohh = NULL;
GNUNET_assert (NULL == rocc->attempt_connect_task_id);
rocc->op_id,
GNUNET_i2s (&rocc->a_id),
rocc->peer->id);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (GNUNET_SCHEDULER_REASON_TIMEOUT == tc->reason)
{
GNUNET_break (0);
* whose identity is in RemoteOverlayConnectCtx
*
* @param cls the RemoteOverlayConnectCtx
- * @param tc the TaskContext from scheduler
*/
static void
-attempt_connect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+attempt_connect_task (void *cls)
{
struct RemoteOverlayConnectCtx *rocc = cls;
* timed out
*
* @param cls the FowardedOperationContext
- * @param tc the TaskContext from the scheduler
*/
static void
-peer_create_forward_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+peer_create_forward_timeout (void *cls)
{
struct ForwardedOperationContext *fopc = cls;
GNUNET_free (fopc->cls);
- GST_forwarded_operation_timeout (fopc, tc);
+ GST_forwarded_operation_timeout (fopc);
}
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_task = NULL;
if (NULL != abort_task)
* abort task to run on test timed out
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n");
abort_task = NULL;
* The shutdown task
*/
static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
shutdown_task_id = NULL;
if (0 != child_exit_code)
static void
-terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+terminate_task (void *cls)
{
static int hard_kill;
* process died).
*
* @param cls closure, NULL if we need to self-restart
- * @param tc context
*/
static void
-child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+child_death_task (void *cls)
{
const struct GNUNET_DISK_FileHandle *pr;
char c[16];
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
child_death_task_id = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
{
child_death_task_id =
* The main scheduler run task
*
* @param cls NULL
- * @param tc scheduler task context
*/
static void
-run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+run (void *cls)
{
struct GNUNET_TESTBED_Host **hosts;
const struct GNUNET_CONFIGURATION_Handle *null_cfg;
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
* abort task to run on test timed out
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
abort_task = NULL;
LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
* Continuation function.
*
* @param cls closure
- * @param result GNUNET_OK on success,
- * GNUNET_NO if helper process died
- * GNUNET_SYSERR during GNUNET_HELPER_stop
+ * @param result #GNUNET_OK on success,
+ * #GNUNET_NO if helper process died
+ * #GNUNET_SYSERR during GNUNET_HELPER_stop()
*/
static void
cont_cb (void *cls, int result)
* @param client identification of the client
* @param message the actual message
*
- * @return GNUNET_OK on success, GNUNET_SYSERR to stop further processing
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
*/
static int
mst_cb (void *cls, void *client, const struct GNUNET_MessageHeader *message)
* @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down...\n");
if (NULL != abort_task)
* @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
abort_task = NULL;
- do_shutdown (cls, tc);
+ do_shutdown (cls);
}
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
* abort task to run on test timed out
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
abort_task = NULL;
- do_shutdown (cls, tc);
+ do_shutdown (cls);
}
* task for delaying a connect
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_delayed_connect (void *cls)
{
delayed_connect_task = NULL;
FAIL_TEST (NULL == common_operation);
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
* abort task to run on test timed out
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
abort_task = NULL;
GNUNET_SCHEDULER_cancel (delayed_connect_task);
delayed_connect_task = NULL;
}
- do_shutdown (cls, tc);
+ do_shutdown (cls);
}
static void
* task for delaying a connect
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_delayed_connect (void *cls)
{
delayed_connect_task = NULL;
if (NULL != common_operation)
* Shutdown this test case when it takes too long
*
* @param cls NULL
- * @param tc scheduler task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_task = NULL;
if (NULL != barrier)
if (NULL != abort_task) \
GNUNET_SCHEDULER_cancel (abort_task); \
abort_task = NULL; \
- GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \
+ GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); \
return; \
} \
} while (0)
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
* abort task to run on test timed out
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n");
abort_task = NULL;
- do_shutdown (cls, tc);
+ do_shutdown (cls);
}
* @return
*/
static void
-delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+delay_task (void *cls)
{
delay_task_id = NULL;
switch (result)
result = SUCCESS;
GNUNET_TESTBED_operation_done (op);
op = NULL;
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 1), &do_shutdown,
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+ &do_shutdown,
NULL);
break;
default:
* The shutdown task
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
GNUNET_TESTBED_host_destroy (host);
while (0 != num_hosts)
* Task to simulate artificial delay and change the test stage
*
* @param cls NULL
- * @param tc the task context
*/
static void
-step (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+step (void *cls)
{
GNUNET_assert (NULL != step_task);
step_task = NULL;
* Abort task
*
* @param cls NULL
- * @param tc scheduler task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n");
abort_task = NULL;
* Abort task
*
* @param cls NULL
- * @param tc scheduler task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Aborting\n");
abort_task = NULL;
* Abort task
*
* @param cls NULL
- * @param tc scheduler task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test timed out -- Aborting\n");
abort_task = NULL;
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_task = NULL;
if (NULL != abort_task)
GNUNET_SCHEDULER_cancel (abort_task); \
abort_task = NULL; \
if (NULL == shutdown_task) \
- shutdown_task = GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \
+ shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); \
return; \
} \
} while (0)
* abort task to run on test timed out
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
abort_task = NULL;
if (NULL != shutdown_task)
GNUNET_SCHEDULER_cancel (shutdown_task);
- do_shutdown (cls, tc);
+ do_shutdown (cls);
}
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
* abort task to run on test timed out
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
abort_task = NULL;
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_task = NULL;
if (NULL != op)
* Shutdown nicely
*
* @param cls NULL
- * @param tc the task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
shutdown_task = NULL;
if (NULL != op)
static void
-do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_abort (void *cls)
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n");
abort_task = NULL;
static void
-do_write (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_write (void *cls)
{
static int i;
char buf[BSIZE];
* @param tc scheduler task context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
if (NULL != op)
GNUNET_TESTBED_operation_done (op);
* Task for checking whether a host is habitable or not
*
* @param cls GNUNET_TESTBED_HostHabitableCheckHandle
- * @param tc the scheduler task context
*/
static void
-habitability_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+habitability_check (void *cls)
{
struct GNUNET_TESTBED_HostHabitableCheckHandle *h = cls;
void *cb_cls;
* the ready queue.
*
* @param cls NULL
- * @param tc scheduler task context. Not used.
*/
static void
-process_rq_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+process_rq_task (void *cls)
{
struct GNUNET_TESTBED_Operation *op;
struct OperationQueue *queue;
* get_statistics operation.
*
* @param cls the GetStatsContext
- * @param tc the scheduler task context
*/
static void
-call_completion_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+call_completion_task (void *cls)
{
struct GetStatsContext *sc = cls;
* as we cannot destroy the statistics handle in iteration_completion_cb()
*
* @param cls the PeerGetStatsContext
- * @param tc the scheduler task context
*/
static void
-op_done_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+op_done_task (void *cls)
{
struct PeerGetStatsContext *peer_sc = cls;
struct GetStatsContext *sc;
* Task run upon interrupts (SIGINT, SIGTERM) and upon scheduler shutdown.
*
* @param cls the RunContext which has to be acted upon
- * @param tc the scheduler task context
*/
static void
-interrupt (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+interrupt (void *cls)
{
struct GNUNET_TESTBED_RunHandle *rc = cls;
struct GNUNET_TESTBED_Controller *c = rc->c;
* Task for starting peers
*
* @param cls the RunHandle
- * @param tc the task context from scheduler
*/
static void
-start_peers_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+start_peers_task (void *cls)
{
struct GNUNET_TESTBED_RunHandle *rc = cls;
struct RunContextOperation *rcop;
* Task to register all hosts available in the global host list
*
* @param cls the RunContext
- * @param tc the scheduler task context
*/
static void
-register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+register_hosts (void *cls);
/**
* Task to register all hosts available in the global host list
*
* @param cls RunContext
- * @param tc the scheduler task context
*/
static void
-register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+register_hosts (void *cls)
{
struct GNUNET_TESTBED_RunHandle *rc = cls;
struct RunContextOperation *rcop;
* Task run upon timeout while setting up the testbed
*
* @param cls the RunContext
- * @param tc the task context
*/
static void
-timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_task (void *cls)
{
struct GNUNET_TESTBED_RunHandle *rc = cls;
rc->timeout_task = NULL;
- LOG (GNUNET_ERROR_TYPE_ERROR, _("Shutting down testbed due to timeout while setup.\n"));
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("Shutting down testbed due to timeout while setup.\n"));
GNUNET_SCHEDULER_shutdown ();
if (NULL != rc->test_master)
rc->test_master (rc->test_master_cls, rc, 0, NULL, 0, 0);
* Task to call the flush completion notification
*
* @param cls the logger handle
- * @param tc the scheduler task context
*/
static void
-call_flush_completion (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+call_flush_completion (void *cls)
{
struct GNUNET_TESTBED_LOGGER_Handle *h = cls;
GNUNET_TESTBED_LOGGER_FlushCompletion cb;
* be called with 0 as the amount of data sent.
*
* @param cls the logger handle
- * @param tc scheduler task context
*/
static void
-timeout_flush (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_flush (void *cls)
{
struct GNUNET_TESTBED_LOGGER_Handle *h = cls;
GNUNET_TESTBED_LOGGER_FlushCompletion cb;
* Removes the temporary file.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup (void *cls)
{
if (NULL != tmpfilename)
{
* Called whenever we can read stdin non-blocking
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+stdin_cb (void *cls)
{
int c;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
tid = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
GNUNET_assert (0 != (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason));
* Task for shutdown
*
* @param cls the testing context
- * @param tc the tast context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
struct TestingContext *test_ctx = cls;
static void
-do_shutdown2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown2 (void *cls)
{
struct TestingContext *test_ctx = cls;
* Task for shutdown
*
* @param cls the testing context
- * @param tc the tast context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_shutdown (void *cls);
static void
* Task for shutdown
*
* @param cls the testing context
- * @param tc the tast context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
struct TestingContext *test_ctx = cls;
test_ctx));
}
else
- do_shutdown2 (test_ctx, tc);
+ do_shutdown2 (test_ctx);
}
* Task for shutdown
*
* @param cls the testing context
- * @param tc the tast context
*/
static void
-do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_shutdown (void *cls)
{
struct TestingContext *test_ctx = cls;
struct GNUNET_TESTING_Peer *peer;
* Callback to be called when SCHEDULER has been started
*
* @param cls the ServiceContext
- * @param tc the TaskContext
*/
static void
-service_run_main (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+service_run_main (void *cls)
{
struct ServiceContext *sc = cls;
* peer and ask for it.
*
* @param cls for which peer to schedule the HELLO
- * @param tc task context
*/
static void
-schedule_next_hello (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_next_hello (void *cls)
{
struct Peer *pl = cls;
struct FindAdvHelloContext fah;
size_t next_want;
struct GNUNET_TIME_Relative delay;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
pl->hello_delay_task = NULL;
GNUNET_assert (GNUNET_YES == pl->is_connected);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return; /* we're out of here */
if (pl->hello_req != NULL)
* Add peers and schedule connection attempt
*
* @param cls unused, NULL
- * @param tc scheduler context
*/
static void
-add_peer_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+add_peer_task (void *cls)
{
add_task = NULL;
* the transport and core.
*
* @param cls unused, NULL
- * @param tc scheduler context
*/
static void
-cleaning_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleaning_task (void *cls)
{
if (NULL != peerinfo_notify)
{
* Task to asynchronously terminate a session.
*
* @param cls the `struct GNUNET_ATS_SessionKiller` with the information for the kill
- * @param tc scheduler context
*/
static void
-kill_session_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+kill_session_task (void *cls)
{
struct GNUNET_ATS_SessionKiller *sk = cls;
* and cancels pending validations.
*
* @param cls closure, unused
- * @param tc task context (unused)
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GST_neighbours_stop ();
GST_plugins_unload ();
* suggest it again.
*
* @param cls the `struct AddressInfo` of the address to unblock
- * @param tc unused
*/
static void
-unblock_address (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+unblock_address (void *cls)
{
struct AddressInfo *ai = cls;
* Perform next action in the blacklist check.
*
* @param cls the `struct BlacklistCheck*`
- * @param tc unused
*/
static void
-do_blacklist_check (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+do_blacklist_check (void *cls);
/**
* @return number of bytes copied to @a buf
*/
static size_t
-transmit_blacklist_message (void *cls,
+transmit_blacklist_message (void *cls,
size_t size,
void *buf)
{
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending blacklist test for peer `%s' to client %p\n",
- GNUNET_i2s (&bc->peer),
+ GNUNET_i2s (&bc->peer),
bc->bl_pos->client);
bl = bc->bl_pos;
bm.header.size = htons (sizeof (struct BlacklistMessage));
bm.is_allowed = htonl (0);
bm.peer = bc->peer;
memcpy (buf,
- &bm,
+ &bm,
sizeof (bm));
if (GNUNET_YES == bl->call_receive_done)
{
* Perform next action in the blacklist check.
*
* @param cls the `struct GST_BlacklistCheck *`
- * @param tc unused
*/
static void
-do_blacklist_check (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_blacklist_check (void *cls)
{
struct GST_BlacklistCheck *bc = cls;
struct Blacklisters *bl;
"No other blacklist clients active, will allow neighbour `%s'\n",
GNUNET_i2s (&bc->peer));
- bc->cont (bc->cont_cls,
+ bc->cont (bc->cont_cls,
&bc->peer,
bc->address,
bc->session,
GNUNET_SERVER_notify_transmit_ready (bl->client,
sizeof (struct BlacklistMessage),
GNUNET_TIME_UNIT_FOREVER_REL,
- &transmit_blacklist_message,
+ &transmit_blacklist_message,
bc);
}
if (GNUNET_OK == allowed)
return; /* we're done */
GNUNET_STATISTICS_update (GST_stats,
- gettext_noop ("# disconnects due to blacklist"),
+ gettext_noop ("# disconnects due to blacklist"),
1,
GNUNET_NO);
GST_neighbours_force_disconnect (peer);
GNUNET_CONTAINER_DLL_remove (bc_head,
bc_tail,
bc);
- bc->cont (bc->cont_cls,
+ bc->cont (bc->cont_cls,
&bc->peer,
bc->address,
bc->session,
GNUNET_OK);
bl->call_receive_done = GNUNET_NO;
bc->bl_pos = bl->next;
- bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check,
+ bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check,
bc);
}
}
for (bc = bc_head; bc != NULL; bc = bc->next)
if ((bc->bl_pos == bl) && (NULL == bc->task))
{
- bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check,
+ bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check,
bc);
break;
}
struct GST_BlacklistCheck *bc;
struct GST_BlacklistCheck *n;
- n = bc_head;
+ n = bc_head;
while (NULL != (bc = n))
{
n = bc->next;
/* Disallowed by config, disapprove instantly */
GNUNET_STATISTICS_update (GST_stats,
gettext_noop ("# disconnects due to blacklist"),
- 1,
+ 1,
GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Disallowing connection to peer `%s' on transport %s\n"),
GNUNET_i2s (peer),
(NULL != transport_name) ? transport_name : "unspecified");
if (NULL != cont)
- cont (cont_cls,
- peer,
+ cont (cont_cls,
+ peer,
address,
session,
GNUNET_NO);
/* need to query blacklist clients */
bc = GNUNET_new (struct GST_BlacklistCheck);
- GNUNET_CONTAINER_DLL_insert (bc_head,
+ GNUNET_CONTAINER_DLL_insert (bc_head,
bc_tail,
bc);
bc->peer = *peer;
* all of the transports.
*
* @param cls unused
- * @param tc scheduler context
*/
static void
-refresh_hello_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+refresh_hello_task (void *cls)
{
struct GeneratorContext gc;
hello_cb = cb;
hello_cb_cls = cb_cls;
friend_option = friend_only;
- refresh_hello_task (NULL, NULL);
+ refresh_hello_task (NULL);
}
* message.
*
* @param cls the `struct DelayQueueEntry` to transmit
- * @param tc unused
*/
static void
-send_delayed (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_delayed (void *cls)
{
struct DelayQueueEntry *dqe = cls;
struct DelayQueueEntry *next;
* clean up after disconnect).
*
* @param cls the `struct NeighbourMapEntry` for which we are running
- * @param tc scheduler context (unused)
*/
static void
-master_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+master_task (void *cls);
/**
* Task transmitting utilization in a regular interval
*
* @param cls the 'struct NeighbourMapEntry' for which we are running
- * @param tc scheduler context (unused)
*/
static void
-utilization_transmission (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+utilization_transmission (void *cls)
{
util_transmission_tk = NULL;
GNUNET_CONTAINER_multipeermap_iterate (neighbours,
* clean up after disconnect).
*
* @param cls the 'struct NeighbourMapEntry' for which we are running
- * @param tc scheduler context (unused)
*/
static void
-master_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+master_task (void *cls)
{
struct NeighbourMapEntry *n = cls;
struct GNUNET_TIME_Relative delay;
* Task to asynchronously run #free_neighbour().
*
* @param cls the `struct NeighbourMapEntry` to free
- * @param tc unused
*/
static void
-delayed_disconnect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext* tc)
+delayed_disconnect (void *cls)
{
struct NeighbourMapEntry *n = cls;
* longer valid and then possibly triggers its removal.
*
* @param cls the `struct ValidationEntry`
- * @param tc scheduler context (unused)
*/
static void
-timeout_hello_validation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_hello_validation (void *cls)
{
struct ValidationEntry *ve = cls;
struct GNUNET_TIME_Absolute max;
* Do address validation again to keep address valid.
*
* @param cls the `struct ValidationEntry`
- * @param tc scheduler context (unused)
*/
static void
-revalidate_address (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+revalidate_address (void *cls)
{
struct ValidationEntry *ve = cls;
struct GNUNET_TIME_Relative canonical_delay;
* Stops monitoring activity.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct Iteration *icur;
struct Iteration *inext;
* Stops monitoring activity.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct GNUNET_TIME_Relative duration;
struct ValidationResolutionContext *cur;
* We are done, shut down.
*/
static void
-operation_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+operation_timeout (void *cls)
{
struct PeerResolutionContext *cur;
struct PeerResolutionContext *next;
* @param tc gnunet scheduler task context
*/
static void
-client_run (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+client_run (void *cls);
/**
* is the delayed task that actually disconnects the PUT.
*
* @param cls the `struct GNUNET_ATS_Session *` with the put
- * @param tc scheduler context
*/
static void
-client_put_disconnect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+client_put_disconnect (void *cls)
{
struct GNUNET_ATS_Session *s = cls;
* Wake up a curl handle which was suspended
*
* @param cls the session
- * @param tc task context
*/
static void
-client_wake_up (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+client_wake_up (void *cls)
{
struct GNUNET_ATS_Session *s = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
s->recv_wakeup_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
LOG (GNUNET_ERROR_TYPE_DEBUG,
* Task performing curl operations
*
* @param cls plugin as closure
- * @param tc scheduler task context
*/
static void
-client_run (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+client_run (void *cls)
{
struct HTTP_Client_Plugin *plugin = cls;
int running;
CURLMsg *msg;
int put_request; /* GNUNET_YES if easy handle is put, GNUNET_NO for get */
int msgs_left;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
plugin->client_perform_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* Session was idle, so disconnect it
*
* @param cls the `struct GNUNET_ATS_Session` of the idle session
- * @param tc scheduler context
*/
static void
-client_session_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+client_session_timeout (void *cls)
{
struct GNUNET_ATS_Session *s = cls;
struct GNUNET_TIME_Relative left;
* Wake up an MHD connection which was suspended
*
* @param cls the session
- * @param tc task context
*/
static void
-server_wake_up (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+server_wake_up (void *cls)
{
struct GNUNET_ATS_Session *s = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
s->recv_wakeup_task = NULL;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* Session was idle, so disconnect it
*
* @param cls the session
- * @param tc task context
*/
static void
-server_session_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+server_session_timeout (void *cls)
{
struct GNUNET_ATS_Session *s = cls;
struct GNUNET_TIME_Relative left;
* and schedule the next run.
*
* @param cls plugin as closure
- * @param tc task context
*/
static void
-server_v4_run (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+server_v4_run (void *cls)
{
struct HTTP_Server_Plugin *plugin = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
plugin->server_v4_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
plugin->server_v4_immediately = GNUNET_NO;
* and schedule the next run.
*
* @param cls plugin as closure
- * @param tc task context
*/
static void
-server_v6_run (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+server_v6_run (void *cls)
{
struct HTTP_Server_Plugin *plugin = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
plugin->server_v6_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
plugin->server_v6_immediately = GNUNET_NO;
* Notify server about our external hostname
*
* @param cls plugin
- * @param tc task context (unused)
*/
static void
-server_notify_external_hostname (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+server_notify_external_hostname (void *cls)
{
struct HTTP_Server_Plugin *plugin = cls;
struct HttpAddress *ext_addr;
size_t ext_addr_len;
unsigned int urlen;
char *url;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
plugin->notify_ext_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* Session was idle for too long, so disconnect it
*
* @param cls the `struct GNUNET_ATS_Session` of the idle session
- * @param tc scheduler context
*/
static void
-session_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+session_timeout (void *cls)
{
struct GNUNET_ATS_Session *s = cls;
struct GNUNET_TIME_Relative left;
* Task cleaning up a NAT connection attempt after timeout
*
* @param cls the `struct GNUNET_ATS_Session`
- * @param tc scheduler context (unused)
*/
static void
-nat_connect_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+nat_connect_timeout (void *cls)
{
struct GNUNET_ATS_Session *session = cls;
* receiving from the TCP client now.
*
* @param cls the `struct GNUNET_ATS_Session *`
- * @param tc task context (unused)
*/
static void
-delayed_done (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+delayed_done (void *cls)
{
struct GNUNET_ATS_Session *session = cls;
* Then reschedule this function to be called again once more is available.
*
* @param cls the plugin handle
- * @param tc the scheduling context (for rescheduling this function again)
*/
static void
-udp_plugin_select_v4 (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+udp_plugin_select_v4 (void *cls);
/**
* Then reschedule this function to be called again once more is available.
*
* @param cls the plugin handle
- * @param tc the scheduling context (for rescheduling this function again)
*/
static void
-udp_plugin_select_v6 (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+udp_plugin_select_v6 (void *cls);
/**
* Session was idle, so disconnect it.
*
* @param cls the `struct GNUNET_ATS_Session` to time out
- * @param tc scheduler context
*/
static void
-session_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+session_timeout (void *cls)
{
struct GNUNET_ATS_Session *s = cls;
struct Plugin *plugin = s->plugin;
* Then reschedule this function to be called again once more is available.
*
* @param cls the plugin handle
- * @param tc the scheduling context
*/
static void
-udp_plugin_select_v4 (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+udp_plugin_select_v4 (void *cls)
{
struct Plugin *plugin = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
plugin->select_task_v4 = NULL;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* Then reschedule this function to be called again once more is available.
*
* @param cls the plugin handle
- * @param tc the scheduling context
*/
static void
-udp_plugin_select_v6 (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+udp_plugin_select_v6 (void *cls)
{
struct Plugin *plugin = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
plugin->select_task_v6 = NULL;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
static void
-udp_ipv4_broadcast_send (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+udp_ipv4_broadcast_send (void *cls)
{
struct BroadcastAddress *baddr = cls;
struct Plugin *plugin = baddr->plugin;
static void
-udp_ipv6_broadcast_send (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+udp_ipv6_broadcast_send (void *cls)
{
struct BroadcastAddress *baddr = cls;
struct Plugin *plugin = baddr->plugin;
* Session was idle for too long, so disconnect it
*
* @param cls the `struct GNUNET_ATS_Session *` to disconnect
- * @param tc scheduler context
*/
static void
-session_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+session_timeout (void *cls)
{
struct GNUNET_ATS_Session *session = cls;
struct GNUNET_TIME_Relative left;
* Then reschedule this function to be called again once more is available.
*
* @param cls the plugin handle
- * @param tc the scheduling context
*/
static void
-unix_plugin_select_read (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+unix_plugin_select_read (void *cls)
{
struct Plugin *plugin = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
plugin->read_task = NULL;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* Then reschedule this function to be called again once more is available.
*
* @param cls the plugin handle
- * @param tc the scheduling context
*/
static void
-unix_plugin_select_write (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+unix_plugin_select_write (void *cls)
{
struct Plugin *plugin = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
plugin->write_task = NULL;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* Notify transport service about address
*
* @param cls the plugin
- * @param tc unused
*/
static void
-address_notification (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+address_notification (void *cls)
{
struct Plugin *plugin = cls;
struct GNUNET_HELLO_Address *address;
* A session is timing out. Clean up.
*
* @param cls pointer to the Session
- * @param tc unused
*/
static void
-session_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+session_timeout (void *cls)
{
struct GNUNET_ATS_Session *session = cls;
struct GNUNET_TIME_Relative left;
* A FragmentMessage has timed out. Remove it.
*
* @param cls pointer to the 'struct FragmentMessage'
- * @param tc unused
*/
static void
-fragmentmessage_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+fragmentmessage_timeout (void *cls)
{
struct FragmentMessage *fm = cls;
* A MAC endpoint is timing out. Clean up.
*
* @param cls pointer to the `struct MacEndpoint *`
- * @param tc pointer to the GNUNET_SCHEDULER_TaskContext
*/
static void
-macendpoint_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+macendpoint_timeout (void *cls)
{
struct MacEndpoint *endpoint = cls;
struct GNUNET_TIME_Relative timeout;
* Task to (periodically) send a HELLO beacon
*
* @param cls pointer to the plugin struct
- * @param tc scheduler context
*/
static void
-send_hello_beacon (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_hello_beacon (void *cls)
{
struct Plugin *plugin = cls;
uint16_t size;
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
struct AddressWrapper *w;
int c = 0;
}
static void
-wait_end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+wait_end (void *cls)
{
timeout_wait = NULL;
if (0 == addresses_reported)
static void
-test_addr_string (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+test_addr_string (void *cls)
{
struct AddressWrapper *w = cls;
void *s2a;
static void
-measure (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+measure (void *cls)
{
static int counter;
static void
-progress_indicator (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+progress_indicator (void *cls)
{
static int counter;
GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
}
+
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
static void
-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id));
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");
static void
-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id));
static void
-end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping\n");
}
}
+
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
if (send_task != NULL)
{
static void
-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id));
ok = 0;
}
+
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
static void
-stop_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+stop_peer (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
static void
-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id));
}
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
th = NULL;
}
+
static void
-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
#endif
/* end of test_transport_api_limited_sockets.c */
-
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
static void
-sendtask_request_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask_request_task (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p2->id));
static void
-sendtask_response_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask_response_task (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
{
GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
}
+
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
static void
-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+sendtask (void *cls);
+
static void
notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
static void
-sendtask (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id));
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
static void
-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+sendtask (void *cls);
static void
static void
-sendtask (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
struct GNUNET_TIME_Relative delay;
struct GNUNET_ATS_Properties prop;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id));
static void
-end_badly (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Fail! Stopping peers\n");
static void
-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id));
}
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
static void
-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id));
static void
-sendtask (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
start_time = GNUNET_TIME_absolute_get ();
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static void
-end_badly (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
static void
-sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
char *receiver_s = GNUNET_strdup (GNUNET_i2s (&p1->id));
static void
-end_badly (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
static void
-sendtask (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+sendtask (void *cls)
{
- send_task = NULL;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ send_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
GNUNET_TRANSPORT_TESTING_done (tth);
}
+
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
static void
-timer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timer (void *cls)
{
static int percentage;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
timer_task = NULL;
-
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
#define OKPP do { ok++; } while (0)
#endif
+
static void
-run_stage(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+run_stage(void *cls);
+
static void
-end(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end (void *cls)
{
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Stopping\n");
}
}
+
static void
-end_badly(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
die_task = NULL;
stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL );
}
+
static void
-connect_timeout(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+connect_timeout(void *cls)
{
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Peers not connected, next stage\n");
timeout_task = NULL;
- stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL );
+ stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL);
}
+
static int started;
-void
+
+static void
start_cb(struct PeerContext *p, void *cls)
{
return GNUNET_OK;
}
+
static void
-run_stage(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_stage (void *cls)
{
stage_task = NULL;
if (NULL != die_task)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Exiting\n");
}
+
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n");
timeout_task = NULL;
* Offer the current HELLO of P2 to P1.
*
* @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectRequest `
- * @param tc scheduler context
*/
static void
-offer_hello (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+offer_hello (void *cls);
/**
* transport service.
*/
static void
-hello_offered (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+hello_offered (void *cls)
{
struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls;
* Offer the current HELLO of P2 to P1.
*
* @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectRequest `
- * @param tc scheduler context
*/
static void
-offer_hello (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+offer_hello (void *cls)
{
struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls;
struct PeerContext *p1 = cc->p1;
struct PeerContext *p2 = cc->p2;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
cc->tct = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
{
* A neighbour has not gotten a SEND_OK in a while. Print a warning.
*
* @param cls the `struct Neighbour`
- * @param tc scheduler context
*/
static void
-do_warn_unready (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_warn_unready (void *cls)
{
struct Neighbour *n = cls;
struct GNUNET_TIME_Relative delay;
* network congestion. Notify the initiator and clean up.
*
* @param cls the `struct GNUNET_TRANSPORT_TransmitHandle`
- * @param tc scheduler context
*/
static void
-timeout_request_due_to_congestion (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_request_due_to_congestion (void *cls)
{
struct GNUNET_TRANSPORT_TransmitHandle *th = cls;
struct Neighbour *n = th->neighbour;
* list or the peer message queues to the service.
*
* @param cls transport service to schedule a transmission for
- * @param tc scheduler context
*/
static void
-schedule_transmission_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_transmission_task (void *cls)
{
struct GNUNET_TRANSPORT_Handle *h = cls;
size_t size;
* Try again to connect to transport service.
*
* @param cls the handle to the transport service
- * @param tc scheduler context
*/
static void
-reconnect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect (void *cls)
{
struct GNUNET_TRANSPORT_Handle *h = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
h->reconnect_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
/* shutdown, just give up */
struct GNUNET_TRANSPORT_OfferHelloHandle *ohh = cls;
struct GNUNET_MessageHeader *msg = ohh->msg;
uint16_t ssize;
- struct GNUNET_SCHEDULER_TaskContext tc;
- tc.read_ready = NULL;
- tc.write_ready = NULL;
- tc.reason = GNUNET_SCHEDULER_REASON_TIMEOUT;
if (NULL == buf)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Timeout while trying to transmit `%s' request.\n",
"HELLO");
if (NULL != ohh->cont)
- ohh->cont (ohh->cls,
- &tc);
+ ohh->cont (ohh->cls);
GNUNET_free (msg);
GNUNET_CONTAINER_DLL_remove (ohh->th->oh_head,
ohh->th->oh_tail,
msg,
ssize);
GNUNET_free (msg);
- tc.reason = GNUNET_SCHEDULER_REASON_READ_READY;
if (NULL != ohh->cont)
- ohh->cont (ohh->cls,
- &tc);
+ ohh->cont (ohh->cls);
GNUNET_CONTAINER_DLL_remove (ohh->th->oh_head,
ohh->th->oh_tail,
ohh);
* Task to call the HelloUpdateCallback of the GetHelloHandle
*
* @param cls the `struct GNUNET_TRANSPORT_GetHelloHandle`
- * @param tc the scheduler task context
*/
static void
-call_hello_update_cb_async (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+call_hello_update_cb_async (void *cls)
{
struct GNUNET_TRANSPORT_GetHelloHandle *ghh = cls;
* Task run to re-establish the connection.
*
* @param cls our `struct GNUNET_TRANSPORT_PeerMonitoringContext *`
- * @param tc scheduler context, unused
*/
static void
-do_peer_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_peer_connect (void *cls)
{
struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls;
* Task run to re-establish the connection.
*
* @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *`
- * @param tc scheduler context, unused
*/
static void
-do_plugin_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_plugin_connect (void *cls)
{
struct GNUNET_TRANSPORT_PluginMonitor *pm = cls;
* Task run to re-establish the connection.
*
* @param cls our `struct GNUNET_TRANSPORT_ValidationMonitoringContext *`
- * @param tc scheduler context, unused
*/
static void
-do_val_connect (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_val_connect (void *cls)
{
struct GNUNET_TRANSPORT_ValidationMonitoringContext *val_ctx = cls;
}
addr = (const char *) &vr_msg[1];
transport_name = &addr[alen];
-
+
if (transport_name[tlen - 1] != '\0')
{
/* Corrupt plugin name */
}
return;
}
-
+
/* notify client */
address = GNUNET_HELLO_address_allocate (&vr_msg->peer,
transport_name,
* Task run whenever we hit the bandwidth limit for a tracker.
*
* @param cls the `struct GNUNET_BANDWIDTH_Tracker`
- * @param tc scheduler context
*/
static void
-excess_trigger (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+excess_trigger (void *cls)
{
struct GNUNET_BANDWIDTH_Tracker *av = cls;
* Continuation to call the receive callback.
*
* @param cls our handle to the client connection
- * @param tc scheduler context
*/
static void
-receive_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+receive_task (void *cls)
{
struct GNUNET_CLIENT_Connection *client = cls;
GNUNET_CLIENT_MessageHandler handler = client->receiver_handler;
* and then cleans up.
*
* @param cls the `struct GNUNET_CLIENT_TestHandle`
- * @param tc scheduler context
*/
static void
-report_result (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+report_result (void *cls)
{
struct GNUNET_CLIENT_TestHandle *th = cls;
* service after a while.
*
* @param cls our `struct GNUNET_CLIENT_TransmitHandle` of the request
- * @param tc unused
*/
static void
-client_delayed_retry (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+client_delayed_retry (void *cls)
{
struct GNUNET_CLIENT_TransmitHandle *th = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
struct GNUNET_TIME_Relative delay;
th->reconnect_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
/* give up, was shutdown */
struct GNUNET_CLIENT_Connection *client = th->client;
size_t ret;
struct GNUNET_TIME_Relative delay;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
LOG (GNUNET_ERROR_TYPE_DEBUG,
"client_notify is running\n");
th->th = NULL;
client->th = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (NULL == buf)
{
delay = GNUNET_TIME_absolute_get_remaining (th->timeout);
if ( (GNUNET_YES != th->auto_retry) ||
(0 == --th->attempts_left) ||
(delay.rel_value_us < 1)||
- (0 != (GNUNET_SCHEDULER_get_reason() & GNUNET_SCHEDULER_REASON_SHUTDOWN)))
+ (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)))
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Transmission failed %u times, giving up.\n",
static void
-schedule_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_disconnect (void *cls)
{
struct GNUNET_CLIENT_MANAGER_Connection *mgr = cls;
GNUNET_CLIENT_MANAGER_disconnect (mgr, GNUNET_NO,
*
* @param cls
* Channel handle.
- * @param tc
- * Scheduler context.
*/
static void
-schedule_reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_reconnect (void *cls)
{
struct GNUNET_CLIENT_MANAGER_Connection *mgr = cls;
mgr->reconnect_task = NULL;
* We are ready to transmit (or got a timeout).
*
* @param cls our connection handle
- * @param tc task context describing why we are here
*/
static void
-transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+transmit_ready (void *cls);
/**
* to read.
*
* @param cls connection to read from
- * @param tc scheduler context
*/
static void
-receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+receive_ready (void *cls);
/**
* Scheduler let us know that we're either ready to write on the
* socket OR connect timed out. Do the right thing.
*
- * @param cls the "struct AddressProbe*" with the address that we are probing
- * @param tc success or failure info about the connect attempt.
+ * @param cls the `struct AddressProbe *` with the address that we are probing
*/
static void
-connect_probe_continuation (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connect_probe_continuation (void *cls)
{
struct AddressProbe *ap = cls;
struct GNUNET_CONNECTION_Handle *connection = ap->connection;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
struct AddressProbe *pos;
int error;
socklen_t len;
len = sizeof (error);
errno = 0;
error = 0;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if ((0 == (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) ||
(GNUNET_OK !=
GNUNET_NETWORK_socket_getsockopt (ap->sock, SOL_SOCKET, SO_ERROR, &error,
* or have data ready to read.
*
* @param cls connection to read from
- * @param tc scheduler context
*/
static void
-receive_ready (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+receive_ready (void *cls)
{
struct GNUNET_CONNECTION_Handle *connection = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
char buffer[connection->max];
ssize_t ret;
GNUNET_CONNECTION_Receiver receiver;
connection->read_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
/* ignore shutdown request, go again immediately */
* This task notifies the client about the timeout.
*
* @param cls the `struct GNUNET_CONNECTION_Handle`
- * @param tc scheduler context
*/
static void
-transmit_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_timeout (void *cls)
{
struct GNUNET_CONNECTION_Handle *connection = cls;
GNUNET_CONNECTION_TransmitReadyNotify notify;
* This task notifies the client about the error.
*
* @param cls the `struct GNUNET_CONNECTION_Handle`
- * @param tc scheduler context
*/
static void
-connect_error (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connect_error (void *cls)
{
struct GNUNET_CONNECTION_Handle *connection = cls;
GNUNET_CONNECTION_TransmitReadyNotify notify;
* We are ready to transmit (or got a timeout).
*
* @param cls our connection handle
- * @param tc task context describing why we are here
*/
static void
-transmit_ready (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_ready (void *cls)
{
struct GNUNET_CONNECTION_Handle *connection = cls;
GNUNET_CONNECTION_TransmitReadyNotify notify;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
ssize_t ret;
size_t have;
GNUNET_assert (NULL != connection->write_task);
connection->write_task = NULL;
GNUNET_assert (NULL == connection->nth.timeout_task);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
if (NULL != connection->sock)
* File hashing task.
*
* @param cls closure
- * @param tc context
*/
static void
-file_hash_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+file_hash_task (void *cls)
{
struct GNUNET_CRYPTO_FileHashContext *fhc = cls;
struct GNUNET_HashCode *res;
* Task used by the directory iterator.
*/
static void
-directory_iterator_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+directory_iterator_task (void *cls)
{
struct GNUNET_DISK_DirectoryIterator *iter = cls;
char *name;
* @param tc task context
*/
static void
-find_proof (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+find_proof (void *cls)
{
#define ROUND_SIZE 10
uint64_t counter;
unsigned int i;
struct GNUNET_TIME_Absolute timestamp;
struct GNUNET_TIME_Relative elapsed;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
{
write_proof ();
* process died) or when user presses CTRL-C.
*
* @param cls closure, NULL
- * @param tc scheduler context
*/
static void
-maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+maint_child_death (void *cls)
{
enum GNUNET_OS_ProcessStatusType type;
if ( (GNUNET_OK !=
* NULL-terminated list of command-line arguments.
*/
char **binary_argv;
-
+
/**
* Task to read from the helper.
*/
* Restart the helper process.
*
* @param cls handle to the helper process
- * @param tc scheduler context
*/
static void
-restart_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+restart_task (void *cls);
/**
* Read from the helper-process
*
* @param cls handle to the helper process
- * @param tc scheduler context
*/
static void
-helper_read (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+helper_read (void *cls)
{
struct GNUNET_HELPER_Handle *h = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE] GNUNET_ALIGN;
ssize_t t;
h->read_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
/* try again */
* Restart the helper process.
*
* @param cls handle to the helper process
- * @param tc scheduler context
*/
static void
-restart_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+restart_task (void *cls)
{
struct GNUNET_HELPER_Handle*h = cls;
h->restart_task = NULL;
h->retry_back_off++;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Restarting helper with back-off %u\n",
h->retry_back_off);
start_helper (h);
* Write to the helper-process
*
* @param cls handle to the helper process
- * @param tc scheduler context
*/
static void
-helper_write (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+helper_write (void *cls)
{
struct GNUNET_HELPER_Handle *h = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
struct GNUNET_HELPER_SendHandle *sh;
const char *buf;
ssize_t t;
h->write_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
/* try again */
* results in undefined behavior if not used carefully.
*
* @param cls message queue to send the next message with
- * @param tc scheduler context
*/
static void
-impl_send_continue (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+impl_send_continue (void *cls)
{
struct GNUNET_MQ_Handle *mq = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
struct GNUNET_MQ_Envelope *current_envelope;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
* This handler is called when there are control data to be read on the pipe
*
* @param cls the 'struct GNUNET_DISK_FileHandle' of the control pipe
- * @param tc scheduler context
*/
static void
-parent_control_handler (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+parent_control_handler (void *cls)
{
struct GNUNET_DISK_FileHandle *control_pipe = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
char sig;
char *pipe_fd;
ssize_t ret;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__,
+ tc = GNUNET_SCHEDULER_get_task_context ();
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "`%s' invoked because of %d\n", __FUNCTION__,
tc->reason);
if (0 != (tc->reason &
(GNUNET_SCHEDULER_REASON_SHUTDOWN | GNUNET_SCHEDULER_REASON_TIMEOUT)))
* variable) and raise those signals.
*
* @param cls closure (unused)
- * @param tc scheduler context (unused)
*/
void
-GNUNET_OS_install_parent_control_handler (void *cls,
- const struct
- GNUNET_SCHEDULER_TaskContext *tc)
+GNUNET_OS_install_parent_control_handler (void *cls)
{
const char *env_buf;
char *env_buf_end;
/**
* Read from the process and call the line processor.
*
- * @param cls the 'struct GNUNET_OS_CommandHandle'
- * @param tc scheduler context
+ * @param cls the `struct GNUNET_OS_CommandHandle *`
*/
static void
-cmd_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+cmd_read (void *cls)
{
struct GNUNET_OS_CommandHandle *cmd = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
GNUNET_OS_LineProcessor proc;
char *end;
ssize_t ret;
cmd->rtask = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (GNUNET_YES != GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, cmd->r))
{
/* timeout, shutdown, etc. */
* program. Runs the program-specific main task.
*/
static void
-program_main (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+program_main (void *cls)
{
struct CommandContext *cc = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
GNUNET_SPEEDUP_start_(cc->cfg);
* numeric addresses.
*
* @param cls `struct GNUNET_RESOLVER_RequestHandle` for the request
- * @param tc unused scheduler context
*/
static void
-numeric_resolution (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+numeric_resolution (void *cls)
{
struct GNUNET_RESOLVER_RequestHandle *rh = cls;
struct sockaddr_in v4;
* respective loopback numeric addresses.
*
* @param cls `struct GNUNET_RESOLVER_RequestHandle` for the request
- * @param tc unused scheduler context
*/
static void
-loopback_resolution (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+loopback_resolution (void *cls)
{
struct GNUNET_RESOLVER_RequestHandle *rh = cls;
struct sockaddr_in v4;
* Task executed on system shutdown.
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
s_task = NULL;
GNUNET_RESOLVER_disconnect ();
* Now try to reconnect to the resolver service.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-reconnect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
r_task = NULL;
if (NULL == req_head)
return; /* no work pending */
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
LOG (GNUNET_ERROR_TYPE_DEBUG,
* A DNS resolution timed out. Notify the application.
*
* @param cls the `struct GNUNET_RESOLVER_RequestHandle *`
- * @param tc scheduler context
*/
static void
-handle_lookup_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+handle_lookup_timeout (void *cls)
{
struct GNUNET_RESOLVER_RequestHandle *rh = cls;
* conversion and invoke the callback.
*
* @param cls `struct GNUNET_RESOLVER_RequestHandle` for the request
- * @param tc unused scheduler context
*/
static void
-numeric_reverse (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+numeric_reverse (void *cls)
{
struct GNUNET_RESOLVER_RequestHandle *rh = cls;
char *result;
*/
static GNUNET_SCHEDULER_select scheduler_select;
+/**
+ * Task context of the current task.
+ */
+static struct GNUNET_SCHEDULER_TaskContext tc;
+
/**
* Closure for #scheduler_select.
*/
{
enum GNUNET_SCHEDULER_Priority p;
struct GNUNET_SCHEDULER_Task *pos;
- struct GNUNET_SCHEDULER_TaskContext tc;
max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP;
do
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Running task: %p\n",
pos);
- pos->callback (pos->callback_cls, &tc);
+ pos->callback (pos->callback_cls);
#if EXECINFO
unsigned int i;
/**
- * Obtain the reason code for why the current task was
- * started. Will return the same value as
- * the `struct GNUNET_SCHEDULER_TaskContext`'s reason field.
+ * Obtain the task context, giving the reason why the current task was
+ * started.
*
- * @return reason(s) why the current task is run
+ * @return current tasks' scheduler context
*/
-enum GNUNET_SCHEDULER_Reason
-GNUNET_SCHEDULER_get_reason ()
+const struct GNUNET_SCHEDULER_TaskContext *
+GNUNET_SCHEDULER_get_task_context ()
{
GNUNET_assert (NULL != active_task);
- return active_task->reason;
+ return &tc;
}
*
* @param cls handle to our server for which we are processing the listen
* socket
- * @param tc reason why we are running right now
*/
static void
-process_listen_socket (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+process_listen_socket (void *cls)
{
struct GNUNET_SERVER_Handle *server = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
struct GNUNET_CONNECTION_Handle *sock;
unsigned int i;
server->listen_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
/* ignore shutdown, someone else will take care of it! */
* Helper function for #test_monitor_clients() to trigger
* #GNUNET_SERVER_destroy() after the stack has unwound.
*
- * @param cls the 'struct GNUNET_SERVER_Handle' to destroy
- * @param tc unused
+ * @param cls the `struct GNUNET_SERVER_Handle *` to destroy
*/
static void
-do_destroy (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_destroy (void *cls)
{
struct GNUNET_SERVER_Handle *server = cls;
* Task run to warn about missing calls to #GNUNET_SERVER_receive_done.
*
* @param cls our `struct GNUNET_SERVER_Client *` to process more requests from
- * @param tc scheduler context (unused)
*/
static void
-warn_no_receive_done (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+warn_no_receive_done (void *cls)
{
struct GNUNET_SERVER_Client *client = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
GNUNET_break (0 != client->warn_type); /* type should never be 0 here, as we don't use 0 */
client->warn_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
&warn_no_receive_done, client);
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 == (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
LOG (GNUNET_ERROR_TYPE_WARNING,
_("Processing code for message of type %u did not call `GNUNET_SERVER_receive_done' after %s\n"),
* and process requests.
*
* @param cls our `struct GNUNET_SERVER_Client *` to process more requests from
- * @param tc scheduler context (unused)
*/
static void
-restart_processing (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+restart_processing (void *cls)
{
struct GNUNET_SERVER_Client *client = cls;
* 'connection.c' is not allowed (see #2329).
*
* @param cls connection to destroy
- * @param tc scheduler context (unused)
*/
static void
-destroy_connection (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+destroy_connection (void *cls)
{
struct GNUNET_CONNECTION_Handle *connection = cls;
* Task run during shutdown. Stops the server/service.
*
* @param cls the `struct GNUNET_SERVICE_Context`
- * @param tc unused
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
struct GNUNET_SERVICE_Context *service = cls;
struct GNUNET_SERVER_Handle *server = service->server;
* Initial task for the service.
*
* @param cls service context
- * @param tc unused
*/
static void
-service_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+service_task (void *cls)
{
struct GNUNET_SERVICE_Context *sctx = cls;
unsigned int i;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
(void) GNUNET_SPEEDUP_start_ (sctx->cfg);
/**
* State of the SOCKS5 handshake.
*/
-struct GNUNET_SOCKS_Handshake
+struct GNUNET_SOCKS_Handshake
{
/**
struct GNUNET_CONNECTION_TransmitHandle *th;
/**
- * Our stage in the SOCKS5 handshake
+ * Our stage in the SOCKS5 handshake
*/
int step;
GNUNET_assert (SOCKS5_step_done > ih->step && ih->step >= 0);
switch (ih->step) {
case SOCKS5_step_greet: /* SOCKS5 server's greeting */
- if (b[0] != 5)
+ if (b[0] != 5)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
"Not a SOCKS5 server\n");
b += 2;
break;
case SOCKS5_step_cmd: /* SOCKS5 server's responce to command */
- if (b[0] != 5)
+ if (b[0] != 5)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
"SOCKS5 protocol error\n");
ih->instart = b;
SOCKS5_handshake_done (ih);
return;
- case SOCKS5_step_done:
+ case SOCKS5_step_done:
GNUNET_assert (0);
}
ih->instart = b;
- /* Do not reschedule the sender unless we're done reading.
+ /* Do not reschedule the sender unless we're done reading.
* I imagine this lets us avoid ever cancelling the transmit handle. */
register_sender (ih);
}
* @param handler_cls closure for @a handler
*/
void
-reciever (void *cls,
+reciever (void *cls,
const void *buf, size_t available,
const struct sockaddr * addr,
socklen_t addrlen, int errCode)
*/
size_t
-transmit_ready (void *cls,
+transmit_ready (void *cls,
size_t size,
void *buf)
{
* GNUNET_CONNECTION_notify_transmit_ready() can schedule :
* transmit_timeout() - DNS still working
* connect_error() - DNS done but no socket?
- * transmit_ready() - scheduler shutdown or timeout, or signal_transmit_error()
+ * transmit_ready() - scheduler shutdown or timeout, or signal_transmit_error()
* We'd need to dig into the scheduler to guess at the reason, as
* connection.c tells us nothing itself, but mostly its timouts.
* Initially, we'll simply ignore this and leave massive timeouts, but
* maybe that should change for error handling pruposes. It appears that
* successful operations, including DNS resolution, do not use this. */
- if (NULL==buf)
+ if (NULL == buf)
{
- enum GNUNET_SCHEDULER_Reason reason = GNUNET_SCHEDULER_get_reason ();
- if (0 != (reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+
+ tc = GNUNET_SCHEDULER_get_task_context ();
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return 0;
- if (0 != (reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) {
- if (0==ih->step) {
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) {
+ if (0==ih->step)
+ {
LOG (GNUNET_ERROR_TYPE_WARNING,
"Timeout contacting SOCKS server, retrying indefinitely, but probably hopeless.\n");
register_sender (ih);
- } else {
+ }
+ else
+ {
LOG (GNUNET_ERROR_TYPE_ERROR,
"Timeout during mid SOCKS handshake (step %u), probably not a SOCKS server.\n",
ih->step);
/**
* Initialize a SOCKS5 handshake for authentication via username and
* password. Tor uses SOCKS username and password authentication to assign
- * programs unique circuits.
+ * programs unique circuits.
*
* @param user username for the proxy
* @param pass password for the proxy
unsigned char * n = b++;
*n = 1; /* Number of authentication methods */
/* We support no authentication even when requesting authentication,
- * but this appears harmless, given the way that Tor uses authentication.
+ * but this appears harmless, given the way that Tor uses authentication.
* And some SOCKS5 servers might require this. */
*(b++) = SOCKS5_AUTH_NOAUTH;
if (NULL != user) {
/* There is no apperent reason to support authentication methods beyond
* username and password since afaik Tor does not support them. */
- /* We authenticate with an empty username and password if the server demands
+ /* We authenticate with an empty username and password if the server demands
* them but we do not have any. */
if (user == NULL)
user = "";
/**
- * Initialize a SOCKS5 handshake without authentication, thereby possibly
+ * Initialize a SOCKS5 handshake without authentication, thereby possibly
* sharing a Tor circuit with another process.
*
* @return Valid SOCKS5 hanbdshake handle
/**
* Build request that the SOCKS5 proxy open a TCP/IP stream to the given host
- * and port.
+ * and port.
*
* @param ih SOCKS5 handshake
- * @param hostname
- * @param port
+ * @param hostname
+ * @param port
*/
void
GNUNET_SOCKS_set_handshake_destination (struct GNUNET_SOCKS_Handshake *ih,
* @param c open unused connection, consumed here.
* @return Connection handle that becomes usable when the SOCKS5 handshake completes.
*/
-struct GNUNET_CONNECTION_Handle *
+struct GNUNET_CONNECTION_Handle *
GNUNET_SOCKS_run_handshake(struct GNUNET_SOCKS_Handshake *ih,
struct GNUNET_CONNECTION_Handle *c)
{
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "SOCKSPORT", &port0))
port0 = 9050;
- /* A typical Tor client should usually try port 9150 for the TBB too, but
+ /* A typical Tor client should usually try port 9150 for the TBB too, but
* GUNNet can probably assume a system Tor instalation. */
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST", &host0))
static struct GNUNET_TIME_Relative delta;
-static struct GNUNET_SCHEDULER_Task * speedup_task;
+static struct GNUNET_SCHEDULER_Task *speedup_task;
static void
-do_speedup (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_speedup (void *cls)
{
static long long current_offset;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
speedup_task = NULL;
+ tc = GNUNET_SCHEDULER_get_task_context ();
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
current_offset += delta.rel_value_us;
static void
-task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task (void *cls)
{
struct sockaddr_in sa;
struct sockaddr *sap[2];
static void
-end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ending phase %d, ok is %d\n", phase,
ok);
static void
-read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+read_call (void *cls)
{
const struct GNUNET_DISK_FileHandle *stdout_read_handle = cls;
char level[8];
static void
-task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task (void *cls)
{
phase = 0;
runone ();
static void
-run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_accept (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test accepts connection\n");
asock = GNUNET_CONNECTION_create_from_accept (NULL, NULL, ls);
static void
-task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task (void *cls)
{
ls = open_listen_socket ();
lsock = GNUNET_CONNECTION_create_from_existing (ls);
static void
-run_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_accept (void *cls)
{
void *addr;
size_t alen;
static void
-task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task (void *cls)
{
struct sockaddr_in v4;
static void
-run_accept_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_accept_cancel (void *cls)
{
asock = GNUNET_CONNECTION_create_from_accept (NULL, NULL, ls);
GNUNET_assert (asock != NULL);
static void
-receive_cancel_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+receive_cancel_task (void *cls)
{
int *ok = cls;
static void
-task_receive_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task_receive_cancel (void *cls)
{
ls = open_listen_socket ();
lsock = GNUNET_CONNECTION_create_from_existing (ls);
static void
-task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task_timeout (void *cls)
{
ls = open_listen_socket ();
static void
-task_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task_timeout (void *cls)
{
csock = GNUNET_CONNECTION_create_from_connect (cfg, "localhost", PORT);
GNUNET_assert (csock != NULL);
static void
-task_transmit_cancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task_transmit_cancel (void *cls)
{
int *ok = cls;
struct GNUNET_CONNECTION_TransmitHandle *th;
static void
-file_hasher (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+file_hasher (void *cls)
{
GNUNET_assert (NULL !=
GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
}
static void
-iter_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+iter_task (void *cls)
{
GNUNET_DISK_directory_iterator_start (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
"test", &iter_callback, cls);
}
+
static int
testDirIter ()
{
static void
-clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+clean_up (void *cls)
{
GNUNET_SERVER_destroy (server);
server = NULL;
static void
-task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task (void *cls)
{
struct sockaddr_in sa;
struct sockaddr *sap[2];
GNUNET_assert (GNUNET_YES == notify);
return ok;
}
-
struct read_context rc;
static void
-end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_task (void *cls)
{
if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
{
static void
-read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+read_call (void *cls)
{
int bytes;
static void
-run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+run_task (void *cls)
{
char *fn;
const struct GNUNET_DISK_FileHandle *stdout_read_handle;
static void
-task2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task2 (void *cls)
{
int *ok = cls;
static void
-task3 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task3 (void *cls)
{
int *ok = cls;
static void
-taskWrt (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+taskWrt (void *cls)
{
static char c;
int *ok = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
GNUNET_assert (6 == *ok);
GNUNET_assert (GNUNET_NETWORK_fdset_handle_isset (tc->write_ready, fds[1]));
(*ok) = 7;
static void
-taskNeverRun (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+taskNeverRun (void *cls)
{
GNUNET_assert (0);
}
static void
-taskLast (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+taskLast (void *cls)
{
int *ok = cls;
static void
-taskRd (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+taskRd (void *cls)
{
static char c;
int *ok = cls;
+ const struct GNUNET_SCHEDULER_TaskContext *tc;
+ tc = GNUNET_SCHEDULER_get_task_context ();
GNUNET_assert (7 == *ok);
GNUNET_assert (GNUNET_NETWORK_fdset_handle_isset (tc->read_ready, fds[0]));
GNUNET_assert (1 == GNUNET_DISK_file_read (fds[0], &c, 1));
static void
-task4 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task4 (void *cls)
{
int *ok = cls;
static void
-task1 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task1 (void *cls)
{
int *ok = cls;
static void
-taskShutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+taskShutdown (void *cls)
{
int *ok = cls;
#ifndef MINGW
static void
-taskSig (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+taskSig (void *cls)
{
int *ok = cls;
static void
-taskCancel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+taskCancel (void *cls)
{
int *ok = cls;
* Signature of the main function of a task.
*
* @param cls closure
- * @param tc context
*/
static void
-test_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+test_task (void *cls)
{
struct GNUNET_TIME_Absolute now;
* Final task invoked to clean up.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-finish_up (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+finish_up (void *cls)
{
GNUNET_assert (7 == ok);
ok = 0;
* server.
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+task (void *cls)
{
struct sockaddr_in sa;
struct sockaddr *sap[2];
static void
-finish_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+finish_up (void *cls)
{
GNUNET_assert (ok == 5);
ok = 0;
static void
-notify_disconnect (void *cls, struct GNUNET_SERVER_Client *clientarg)
+notify_disconnect (void *cls,
+ struct GNUNET_SERVER_Client *clientarg)
{
- if (clientarg == NULL)
+ if (NULL == clientarg)
return;
GNUNET_assert (ok == 4);
ok = 5;
static void
-server_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+server_disconnect (void *cls)
{
struct GNUNET_SERVER_Client *argclient = cls;
static void
-task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task (void *cls)
{
struct sockaddr_in sa;
struct sockaddr *sap[2];
static int ok;
static void
-send_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_done (void *cls)
{
struct GNUNET_SERVER_Client *argclient = cls;
static void
-clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+clean_up (void *cls)
{
GNUNET_SERVER_destroy (server);
server = NULL;
static void
-task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task (void *cls)
{
struct sockaddr_in sa;
struct sockaddr *sap[2];
static void
-send_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_done (void *cls)
{
struct GNUNET_SERVER_Client *argclient = cls;
static void
-clean_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+clean_up (void *cls)
{
GNUNET_SERVER_destroy (server);
server = NULL;
static void
-task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task (void *cls)
{
struct sockaddr_un un;
const char *unixpath = "/tmp/testsock";
static void
-do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_stop (void *cls)
{
if (NULL != client)
{
static void
-task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task (void *cls)
{
struct sockaddr_in sa;
struct sockaddr *sap[2];
* @param tc scheduler context, unused
*/
static void
-run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+run (void *cls)
{
cycles++;
fprintf (stderr, "..%u", cycles);
* Function scheduled as very last function, cleans up after us
*
* @param cls unused
- * @param tc unused
*/
static void
-cleanup (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup (void *cls)
{
unsigned int i;
* Shutdown.
*/
static void
-do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_disconnect (void *cls)
{
if (NULL != request)
{
/**
* Connect to the VPN service and start again to transmit our requests.
*
- * @param cls the 'struct GNUNET_VPN_Handle *'
- * @param tc scheduler context
+ * @param cls the `struct GNUNET_VPN_Handle *`
*/
static void
-connect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+connect_task (void *cls)
{
struct GNUNET_VPN_Handle *vh = cls;