diff options
Diffstat (limited to 'src/cadet/gnunet-service-cadet_connection.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_connection.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index 50768d413..548eeb9b3 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c | |||
@@ -95,7 +95,7 @@ struct CadetFlowControl | |||
95 | /** | 95 | /** |
96 | * Task to poll the peer in case of a lost ACK causes stall. | 96 | * Task to poll the peer in case of a lost ACK causes stall. |
97 | */ | 97 | */ |
98 | GNUNET_SCHEDULER_TaskIdentifier poll_task; | 98 | struct GNUNET_SCHEDULER_Task * poll_task; |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * How frequently to poll for ACKs. | 101 | * How frequently to poll for ACKs. |
@@ -190,13 +190,13 @@ struct CadetConnection | |||
190 | * Task to keep the used paths alive at the owner, | 190 | * Task to keep the used paths alive at the owner, |
191 | * time tunnel out on all the other peers. | 191 | * time tunnel out on all the other peers. |
192 | */ | 192 | */ |
193 | GNUNET_SCHEDULER_TaskIdentifier fwd_maintenance_task; | 193 | struct GNUNET_SCHEDULER_Task * fwd_maintenance_task; |
194 | 194 | ||
195 | /** | 195 | /** |
196 | * Task to keep the used paths alive at the destination, | 196 | * Task to keep the used paths alive at the destination, |
197 | * time tunnel out on all the other peers. | 197 | * time tunnel out on all the other peers. |
198 | */ | 198 | */ |
199 | GNUNET_SCHEDULER_TaskIdentifier bck_maintenance_task; | 199 | struct GNUNET_SCHEDULER_Task * bck_maintenance_task; |
200 | 200 | ||
201 | /** | 201 | /** |
202 | * Queue handle for maintainance traffic. One handle for FWD and BCK since | 202 | * Queue handle for maintainance traffic. One handle for FWD and BCK since |
@@ -400,7 +400,7 @@ fc_init (struct CadetFlowControl *fc) | |||
400 | fc->last_pid_recv = (uint32_t) -1; | 400 | fc->last_pid_recv = (uint32_t) -1; |
401 | fc->last_ack_sent = (uint32_t) 0; | 401 | fc->last_ack_sent = (uint32_t) 0; |
402 | fc->last_ack_recv = (uint32_t) 0; | 402 | fc->last_ack_recv = (uint32_t) 0; |
403 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; | 403 | fc->poll_task = NULL; |
404 | fc->poll_time = GNUNET_TIME_UNIT_SECONDS; | 404 | fc->poll_time = GNUNET_TIME_UNIT_SECONDS; |
405 | fc->queue_n = 0; | 405 | fc->queue_n = 0; |
406 | fc->queue_max = (max_msgs_queue / max_connections) + 1; | 406 | fc->queue_max = (max_msgs_queue / max_connections) + 1; |
@@ -1008,9 +1008,9 @@ connection_keepalive (struct CadetConnection *c, int fwd, int shutdown) | |||
1008 | GC_f2s (fwd), GCC_2s (c)); | 1008 | GC_f2s (fwd), GCC_2s (c)); |
1009 | 1009 | ||
1010 | if (fwd) | 1010 | if (fwd) |
1011 | c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK; | 1011 | c->fwd_maintenance_task = NULL; |
1012 | else | 1012 | else |
1013 | c->bck_maintenance_task = GNUNET_SCHEDULER_NO_TASK; | 1013 | c->bck_maintenance_task = NULL; |
1014 | 1014 | ||
1015 | if (GNUNET_NO != shutdown) | 1015 | if (GNUNET_NO != shutdown) |
1016 | return; | 1016 | return; |
@@ -1066,8 +1066,8 @@ static void | |||
1066 | schedule_next_keepalive (struct CadetConnection *c, int fwd) | 1066 | schedule_next_keepalive (struct CadetConnection *c, int fwd) |
1067 | { | 1067 | { |
1068 | struct GNUNET_TIME_Relative delay; | 1068 | struct GNUNET_TIME_Relative delay; |
1069 | GNUNET_SCHEDULER_TaskIdentifier *task_id; | 1069 | struct GNUNET_SCHEDULER_Task * *task_id; |
1070 | GNUNET_SCHEDULER_Task keepalive_task; | 1070 | GNUNET_SCHEDULER_TaskCallback keepalive_task; |
1071 | 1071 | ||
1072 | if (GNUNET_NO == GCC_is_origin (c, fwd)) | 1072 | if (GNUNET_NO == GCC_is_origin (c, fwd)) |
1073 | return; | 1073 | return; |
@@ -1100,7 +1100,7 @@ schedule_next_keepalive (struct CadetConnection *c, int fwd) | |||
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | /* Check that no one scheduled it before us */ | 1102 | /* Check that no one scheduled it before us */ |
1103 | if (GNUNET_SCHEDULER_NO_TASK != *task_id) | 1103 | if (NULL != *task_id) |
1104 | { | 1104 | { |
1105 | /* No need for a _break. It can happen for instance when sending a SYNACK | 1105 | /* No need for a _break. It can happen for instance when sending a SYNACK |
1106 | * for a duplicate SYN: the first SYNACK scheduled the task. */ | 1106 | * for a duplicate SYN: the first SYNACK scheduled the task. */ |
@@ -1168,10 +1168,10 @@ connection_cancel_queues (struct CadetConnection *c, int fwd) | |||
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 1170 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
1171 | if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task) | 1171 | if (NULL != fc->poll_task) |
1172 | { | 1172 | { |
1173 | GNUNET_SCHEDULER_cancel (fc->poll_task); | 1173 | GNUNET_SCHEDULER_cancel (fc->poll_task); |
1174 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; | 1174 | fc->poll_task = NULL; |
1175 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Cancel POLL in ccq for fc %p\n", fc); | 1175 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** Cancel POLL in ccq for fc %p\n", fc); |
1176 | } | 1176 | } |
1177 | peer = get_hop (c, fwd); | 1177 | peer = get_hop (c, fwd); |
@@ -1236,7 +1236,7 @@ connection_poll (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1236 | struct GNUNET_CADET_Poll msg; | 1236 | struct GNUNET_CADET_Poll msg; |
1237 | struct CadetConnection *c; | 1237 | struct CadetConnection *c; |
1238 | 1238 | ||
1239 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; | 1239 | fc->poll_task = NULL; |
1240 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1240 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1241 | { | 1241 | { |
1242 | return; | 1242 | return; |
@@ -1316,7 +1316,7 @@ connection_fwd_timeout (void *cls, | |||
1316 | { | 1316 | { |
1317 | struct CadetConnection *c = cls; | 1317 | struct CadetConnection *c = cls; |
1318 | 1318 | ||
1319 | c->fwd_maintenance_task = GNUNET_SCHEDULER_NO_TASK; | 1319 | c->fwd_maintenance_task = NULL; |
1320 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1320 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1321 | return; | 1321 | return; |
1322 | 1322 | ||
@@ -1358,7 +1358,7 @@ connection_bck_timeout (void *cls, | |||
1358 | { | 1358 | { |
1359 | struct CadetConnection *c = cls; | 1359 | struct CadetConnection *c = cls; |
1360 | 1360 | ||
1361 | c->bck_maintenance_task = GNUNET_SCHEDULER_NO_TASK; | 1361 | c->bck_maintenance_task = NULL; |
1362 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1362 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1363 | return; | 1363 | return; |
1364 | 1364 | ||
@@ -1410,12 +1410,12 @@ connection_reset_timeout (struct CadetConnection *c, int fwd) | |||
1410 | else /* Relay, endpoint. */ | 1410 | else /* Relay, endpoint. */ |
1411 | { | 1411 | { |
1412 | struct GNUNET_TIME_Relative delay; | 1412 | struct GNUNET_TIME_Relative delay; |
1413 | GNUNET_SCHEDULER_TaskIdentifier *ti; | 1413 | struct GNUNET_SCHEDULER_Task * *ti; |
1414 | GNUNET_SCHEDULER_Task f; | 1414 | GNUNET_SCHEDULER_TaskCallback f; |
1415 | 1415 | ||
1416 | ti = fwd ? &c->fwd_maintenance_task : &c->bck_maintenance_task; | 1416 | ti = fwd ? &c->fwd_maintenance_task : &c->bck_maintenance_task; |
1417 | 1417 | ||
1418 | if (GNUNET_SCHEDULER_NO_TASK != *ti) | 1418 | if (NULL != *ti) |
1419 | GNUNET_SCHEDULER_cancel (*ti); | 1419 | GNUNET_SCHEDULER_cancel (*ti); |
1420 | delay = GNUNET_TIME_relative_multiply (refresh_connection_time, 4); | 1420 | delay = GNUNET_TIME_relative_multiply (refresh_connection_time, 4); |
1421 | LOG (GNUNET_ERROR_TYPE_DEBUG, " timing out in %s\n", | 1421 | LOG (GNUNET_ERROR_TYPE_DEBUG, " timing out in %s\n", |
@@ -2376,12 +2376,12 @@ GCC_handle_ack (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2376 | fc->last_ack_recv = ack; | 2376 | fc->last_ack_recv = ack; |
2377 | 2377 | ||
2378 | /* Cancel polling if the ACK is big enough. */ | 2378 | /* Cancel polling if the ACK is big enough. */ |
2379 | if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task && | 2379 | if (NULL != fc->poll_task && |
2380 | GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) | 2380 | GC_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) |
2381 | { | 2381 | { |
2382 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n"); | 2382 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Cancel poll\n"); |
2383 | GNUNET_SCHEDULER_cancel (fc->poll_task); | 2383 | GNUNET_SCHEDULER_cancel (fc->poll_task); |
2384 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; | 2384 | fc->poll_task = NULL; |
2385 | fc->poll_time = GNUNET_TIME_UNIT_SECONDS; | 2385 | fc->poll_time = GNUNET_TIME_UNIT_SECONDS; |
2386 | } | 2386 | } |
2387 | 2387 | ||
@@ -2690,16 +2690,16 @@ GCC_destroy (struct CadetConnection *c) | |||
2690 | 2690 | ||
2691 | if (GNUNET_NO == GCC_is_origin (c, GNUNET_YES) && NULL != c->path) | 2691 | if (GNUNET_NO == GCC_is_origin (c, GNUNET_YES) && NULL != c->path) |
2692 | path_destroy (c->path); | 2692 | path_destroy (c->path); |
2693 | if (GNUNET_SCHEDULER_NO_TASK != c->fwd_maintenance_task) | 2693 | if (NULL != c->fwd_maintenance_task) |
2694 | GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task); | 2694 | GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task); |
2695 | if (GNUNET_SCHEDULER_NO_TASK != c->bck_maintenance_task) | 2695 | if (NULL != c->bck_maintenance_task) |
2696 | GNUNET_SCHEDULER_cancel (c->bck_maintenance_task); | 2696 | GNUNET_SCHEDULER_cancel (c->bck_maintenance_task); |
2697 | if (GNUNET_SCHEDULER_NO_TASK != c->fwd_fc.poll_task) | 2697 | if (NULL != c->fwd_fc.poll_task) |
2698 | { | 2698 | { |
2699 | GNUNET_SCHEDULER_cancel (c->fwd_fc.poll_task); | 2699 | GNUNET_SCHEDULER_cancel (c->fwd_fc.poll_task); |
2700 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL FWD canceled\n"); | 2700 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL FWD canceled\n"); |
2701 | } | 2701 | } |
2702 | if (GNUNET_SCHEDULER_NO_TASK != c->bck_fc.poll_task) | 2702 | if (NULL != c->bck_fc.poll_task) |
2703 | { | 2703 | { |
2704 | GNUNET_SCHEDULER_cancel (c->bck_fc.poll_task); | 2704 | GNUNET_SCHEDULER_cancel (c->bck_fc.poll_task); |
2705 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL BCK canceled\n"); | 2705 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL BCK canceled\n"); |
@@ -3268,7 +3268,7 @@ GCC_start_poll (struct CadetConnection *c, int fwd) | |||
3268 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 3268 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
3269 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n", | 3269 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** POLL %s requested\n", |
3270 | GC_f2s (fwd)); | 3270 | GC_f2s (fwd)); |
3271 | if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task || NULL != fc->poll_msg) | 3271 | if (NULL != fc->poll_task || NULL != fc->poll_msg) |
3272 | { | 3272 | { |
3273 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** not needed (%u, %p)\n", | 3273 | LOG (GNUNET_ERROR_TYPE_DEBUG, " *** not needed (%u, %p)\n", |
3274 | fc->poll_task, fc->poll_msg); | 3274 | fc->poll_task, fc->poll_msg); |
@@ -3295,10 +3295,10 @@ GCC_stop_poll (struct CadetConnection *c, int fwd) | |||
3295 | struct CadetFlowControl *fc; | 3295 | struct CadetFlowControl *fc; |
3296 | 3296 | ||
3297 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 3297 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
3298 | if (GNUNET_SCHEDULER_NO_TASK != fc->poll_task) | 3298 | if (NULL != fc->poll_task) |
3299 | { | 3299 | { |
3300 | GNUNET_SCHEDULER_cancel (fc->poll_task); | 3300 | GNUNET_SCHEDULER_cancel (fc->poll_task); |
3301 | fc->poll_task = GNUNET_SCHEDULER_NO_TASK; | 3301 | fc->poll_task = NULL; |
3302 | } | 3302 | } |
3303 | } | 3303 | } |
3304 | 3304 | ||