diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-24 01:10:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-24 01:10:47 +0000 |
commit | f1f603c7d0b3f03dca46a4f313472288eb080eb1 (patch) | |
tree | 3a29966b02dfb83e0a8a8d5c42b3116380209fb0 /src/fs/gnunet-service-fs_cadet_server.c | |
parent | 53cd5b8eda2fa8db86b0907a62a39598981d008a (diff) | |
download | gnunet-f1f603c7d0b3f03dca46a4f313472288eb080eb1.tar.gz gnunet-f1f603c7d0b3f03dca46a4f313472288eb080eb1.zip |
making GNUNET_SCHEDULER_cancel() perform in O(1) instead of O(n) to help or even fully address #3247
Diffstat (limited to 'src/fs/gnunet-service-fs_cadet_server.c')
-rw-r--r-- | src/fs/gnunet-service-fs_cadet_server.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/fs/gnunet-service-fs_cadet_server.c b/src/fs/gnunet-service-fs_cadet_server.c index 6ce18afb5..74251e4b7 100644 --- a/src/fs/gnunet-service-fs_cadet_server.c +++ b/src/fs/gnunet-service-fs_cadet_server.c | |||
@@ -108,12 +108,12 @@ struct CadetClient | |||
108 | /** | 108 | /** |
109 | * Task that is scheduled to asynchronously terminate the connection. | 109 | * Task that is scheduled to asynchronously terminate the connection. |
110 | */ | 110 | */ |
111 | GNUNET_SCHEDULER_TaskIdentifier terminate_task; | 111 | struct GNUNET_SCHEDULER_Task * terminate_task; |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Task that is scheduled to terminate idle connections. | 114 | * Task that is scheduled to terminate idle connections. |
115 | */ | 115 | */ |
116 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; | 116 | struct GNUNET_SCHEDULER_Task * timeout_task; |
117 | 117 | ||
118 | /** | 118 | /** |
119 | * Size of the last write that was initiated. | 119 | * Size of the last write that was initiated. |
@@ -163,7 +163,7 @@ timeout_cadet_task (void *cls, | |||
163 | struct CadetClient *sc = cls; | 163 | struct CadetClient *sc = cls; |
164 | struct GNUNET_CADET_Channel *tun; | 164 | struct GNUNET_CADET_Channel *tun; |
165 | 165 | ||
166 | sc->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 166 | sc->timeout_task = NULL; |
167 | tun = sc->channel; | 167 | tun = sc->channel; |
168 | sc->channel = NULL; | 168 | sc->channel = NULL; |
169 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 169 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -181,7 +181,7 @@ timeout_cadet_task (void *cls, | |||
181 | static void | 181 | static void |
182 | refresh_timeout_task (struct CadetClient *sc) | 182 | refresh_timeout_task (struct CadetClient *sc) |
183 | { | 183 | { |
184 | if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) | 184 | if (NULL != sc->timeout_task) |
185 | GNUNET_SCHEDULER_cancel (sc->timeout_task); | 185 | GNUNET_SCHEDULER_cancel (sc->timeout_task); |
186 | sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT, | 186 | sc->timeout_task = GNUNET_SCHEDULER_add_delayed (IDLE_TIMEOUT, |
187 | &timeout_cadet_task, | 187 | &timeout_cadet_task, |
@@ -530,9 +530,9 @@ cleaner_cb (void *cls, | |||
530 | GNUNET_STATISTICS_update (GSF_stats, | 530 | GNUNET_STATISTICS_update (GSF_stats, |
531 | gettext_noop ("# cadet connections active"), -1, | 531 | gettext_noop ("# cadet connections active"), -1, |
532 | GNUNET_NO); | 532 | GNUNET_NO); |
533 | if (GNUNET_SCHEDULER_NO_TASK != sc->terminate_task) | 533 | if (NULL != sc->terminate_task) |
534 | GNUNET_SCHEDULER_cancel (sc->terminate_task); | 534 | GNUNET_SCHEDULER_cancel (sc->terminate_task); |
535 | if (GNUNET_SCHEDULER_NO_TASK != sc->timeout_task) | 535 | if (NULL != sc->timeout_task) |
536 | GNUNET_SCHEDULER_cancel (sc->timeout_task); | 536 | GNUNET_SCHEDULER_cancel (sc->timeout_task); |
537 | if (NULL != sc->wh) | 537 | if (NULL != sc->wh) |
538 | GNUNET_CADET_notify_transmit_ready_cancel (sc->wh); | 538 | GNUNET_CADET_notify_transmit_ready_cancel (sc->wh); |