aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/test_cadet_local.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet/test_cadet_local.c')
-rw-r--r--src/cadet/test_cadet_local.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/cadet/test_cadet_local.c b/src/cadet/test_cadet_local.c
index ef6882961..42663b146 100644
--- a/src/cadet/test_cadet_local.c
+++ b/src/cadet/test_cadet_local.c
@@ -53,17 +53,16 @@ static struct GNUNET_CADET_TransmitHandle *mth;
53 * Connect to other client and send data 53 * Connect to other client and send data
54 * 54 *
55 * @param cls Closue (unused). 55 * @param cls Closue (unused).
56 * @param tc TaskContext.
57 */ 56 */
58static void 57static void
59do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 58do_connect (void *cls);
60 59
61 60
62/** 61/**
63 * Shutdown nicely 62 * Shutdown nicely
64 */ 63 */
65static void 64static void
66do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 65do_shutdown (void *cls)
67{ 66{
68 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n"); 67 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "shutdown\n");
69 if (NULL != abort_task) 68 if (NULL != abort_task)
@@ -91,7 +90,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
91 * Something went wrong and timed out. Kill everything and set error flag 90 * Something went wrong and timed out. Kill everything and set error flag
92 */ 91 */
93static void 92static void
94do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 93do_abort (void *cls)
95{ 94{
96 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n"); 95 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ABORT\n");
97 result = GNUNET_SYSERR; 96 result = GNUNET_SYSERR;
@@ -101,7 +100,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
101 GNUNET_SCHEDULER_cancel (shutdown_task); 100 GNUNET_SCHEDULER_cancel (shutdown_task);
102 shutdown_task = NULL; 101 shutdown_task = NULL;
103 } 102 }
104 do_shutdown (cls, tc); 103 do_shutdown (cls);
105} 104}
106 105
107 106
@@ -126,7 +125,8 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
126 if (NULL != shutdown_task) 125 if (NULL != shutdown_task)
127 GNUNET_SCHEDULER_cancel (shutdown_task); 126 GNUNET_SCHEDULER_cancel (shutdown_task);
128 shutdown_task = 127 shutdown_task =
129 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, 128 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
129 &do_shutdown,
130 NULL); 130 NULL);
131 GNUNET_CADET_receive_done (channel); 131 GNUNET_CADET_receive_done (channel);
132 return GNUNET_OK; 132 return GNUNET_OK;
@@ -146,9 +146,11 @@ data_callback (void *cls, struct GNUNET_CADET_Channel *channel,
146 * (can be NULL -- that's not an error) 146 * (can be NULL -- that's not an error)
147 */ 147 */
148static void * 148static void *
149inbound_channel (void *cls, struct GNUNET_CADET_Channel *channel, 149inbound_channel (void *cls,
150 const struct GNUNET_PeerIdentity *initiator, 150 struct GNUNET_CADET_Channel *channel,
151 uint32_t port, enum GNUNET_CADET_ChannelOption options) 151 const struct GNUNET_PeerIdentity *initiator,
152 uint32_t port,
153 enum GNUNET_CADET_ChannelOption options)
152{ 154{
153 long id = (long) cls; 155 long id = (long) cls;
154 156
@@ -247,13 +249,14 @@ do_send (void *cls, size_t size, void *buf)
247 * Connect to other client and send data 249 * Connect to other client and send data
248 * 250 *
249 * @param cls Closue (unused). 251 * @param cls Closue (unused).
250 * @param tc TaskContext.
251 */ 252 */
252static void 253static void
253do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 254do_connect (void *cls)
254{ 255{
255 struct GNUNET_PeerIdentity id; 256 struct GNUNET_PeerIdentity id;
257 const struct GNUNET_SCHEDULER_TaskContext *tc;
256 258
259 tc = GNUNET_SCHEDULER_get_task_context ();
257 if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) 260 if (NULL != tc && 0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
258 return; 261 return;
259 262