aboutsummaryrefslogtreecommitdiff
path: root/src/nse/nse_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-07-14 19:55:48 +0000
committerChristian Grothoff <christian@grothoff.org>2013-07-14 19:55:48 +0000
commitcd96a296196e7951be4064cdab4824fda0b4b1d7 (patch)
tree2d35efa9e1cb3f43aa18ad3ed6b04ca9c7016f6d /src/nse/nse_api.c
parentf271c0f567f00a9adaba5712e21ccd8129e17d74 (diff)
downloadgnunet-cd96a296196e7951be4064cdab4824fda0b4b1d7.tar.gz
gnunet-cd96a296196e7951be4064cdab4824fda0b4b1d7.zip
-cleaner
Diffstat (limited to 'src/nse/nse_api.c')
-rw-r--r--src/nse/nse_api.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c
index 136f4b622..8f4486287 100644
--- a/src/nse/nse_api.c
+++ b/src/nse/nse_api.c
@@ -173,11 +173,11 @@ send_start (void *cls, size_t size, void *buf)
173 struct GNUNET_MessageHeader *msg; 173 struct GNUNET_MessageHeader *msg;
174 174
175 h->th = NULL; 175 h->th = NULL;
176 if (buf == NULL) 176 if (NULL == buf)
177 { 177 {
178 /* Connect error... */ 178 /* Connect error... */
179 LOG (GNUNET_ERROR_TYPE_DEBUG, 179 LOG (GNUNET_ERROR_TYPE_DEBUG,
180 "Shutdown while trying to transmit `%s' request.\n", "START"); 180 "Error while trying to transmit `%s' request.\n", "START");
181 reschedule_connect (h); 181 reschedule_connect (h);
182 return 0; 182 return 0;
183 } 183 }
@@ -205,23 +205,18 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
205 struct GNUNET_NSE_Handle *h = cls; 205 struct GNUNET_NSE_Handle *h = cls;
206 206
207 h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 207 h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
208 if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
209 {
210 /* shutdown, just give up */
211 return;
212 }
213 LOG (GNUNET_ERROR_TYPE_DEBUG, 208 LOG (GNUNET_ERROR_TYPE_DEBUG,
214 "Connecting to network size estimation service.\n"); 209 "Connecting to network size estimation service.\n");
215 GNUNET_assert (h->client == NULL); 210 GNUNET_assert (NULL == h->client);
216 h->client = GNUNET_CLIENT_connect ("nse", h->cfg); 211 h->client = GNUNET_CLIENT_connect ("nse", h->cfg);
217 GNUNET_assert (h->client != NULL); 212 GNUNET_assert (NULL != h->client);
218 213 GNUNET_assert (NULL == h->th);
219 h->th = 214 h->th =
220 GNUNET_CLIENT_notify_transmit_ready (h->client, 215 GNUNET_CLIENT_notify_transmit_ready (h->client,
221 sizeof (struct GNUNET_MessageHeader), 216 sizeof (struct GNUNET_MessageHeader),
222 GNUNET_TIME_UNIT_FOREVER_REL, 217 GNUNET_TIME_UNIT_FOREVER_REL,
223 GNUNET_NO, &send_start, h); 218 GNUNET_NO, &send_start, h);
224 GNUNET_assert (h->th != NULL); 219 GNUNET_assert (NULL != h->th);
225} 220}
226 221
227 222
@@ -259,18 +254,18 @@ GNUNET_NSE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
259void 254void
260GNUNET_NSE_disconnect (struct GNUNET_NSE_Handle *h) 255GNUNET_NSE_disconnect (struct GNUNET_NSE_Handle *h)
261{ 256{
262 GNUNET_assert (h != NULL); 257 GNUNET_assert (NULL != h);
263 if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK) 258 if (h->reconnect_task != GNUNET_SCHEDULER_NO_TASK)
264 { 259 {
265 GNUNET_SCHEDULER_cancel (h->reconnect_task); 260 GNUNET_SCHEDULER_cancel (h->reconnect_task);
266 h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 261 h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
267 } 262 }
268 if (h->th != NULL) 263 if (NULL != h->th)
269 { 264 {
270 GNUNET_CLIENT_notify_transmit_ready_cancel (h->th); 265 GNUNET_CLIENT_notify_transmit_ready_cancel (h->th);
271 h->th = NULL; 266 h->th = NULL;
272 } 267 }
273 if (h->client != NULL) 268 if (NULL != h->client)
274 { 269 {
275 GNUNET_CLIENT_disconnect (h->client); 270 GNUNET_CLIENT_disconnect (h->client);
276 h->client = NULL; 271 h->client = NULL;