aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-07-03 09:35:27 +0000
committerChristian Grothoff <christian@grothoff.org>2015-07-03 09:35:27 +0000
commitf1e619572751f7652db025f66f119d6a0308114b (patch)
tree28b22661afabeeaa57bd8e773f28218be8509817 /src/fs/fs_api.c
parentfece22eebf8c8d54e79d05f748019e7234823828 (diff)
downloadgnunet-f1e619572751f7652db025f66f119d6a0308114b.tar.gz
gnunet-f1e619572751f7652db025f66f119d6a0308114b.zip
-style fixes
Diffstat (limited to 'src/fs/fs_api.c')
-rw-r--r--src/fs/fs_api.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index f16ced603..040ee1b7f 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -307,7 +307,11 @@ process_job_queue (void *cls,
307 num_downloads_change, 307 num_downloads_change,
308 GNUNET_STRINGS_relative_time_to_string (restart_at, GNUNET_YES)); 308 GNUNET_STRINGS_relative_time_to_string (restart_at, GNUNET_YES));
309 309
310 /* make sure we run again */ 310 /* make sure we run again, callbacks might have
311 already re-scheduled the job, so cancel such
312 an operation (if it exists) */
313 if (NULL != h->queue_job)
314 GNUNET_SCHEDULER_cancel (h->queue_job);
311 h->queue_job = 315 h->queue_job =
312 GNUNET_SCHEDULER_add_delayed (restart_at, &process_job_queue, h); 316 GNUNET_SCHEDULER_add_delayed (restart_at, &process_job_queue, h);
313} 317}
@@ -343,7 +347,7 @@ GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h,
343 qe->priority = priority; 347 qe->priority = priority;
344 GNUNET_CONTAINER_DLL_insert_after (h->pending_head, h->pending_tail, 348 GNUNET_CONTAINER_DLL_insert_after (h->pending_head, h->pending_tail,
345 h->pending_tail, qe); 349 h->pending_tail, qe);
346 if (h->queue_job != NULL) 350 if (NULL != h->queue_job)
347 GNUNET_SCHEDULER_cancel (h->queue_job); 351 GNUNET_SCHEDULER_cancel (h->queue_job);
348 h->queue_job = GNUNET_SCHEDULER_add_now (&process_job_queue, h); 352 h->queue_job = GNUNET_SCHEDULER_add_now (&process_job_queue, h);
349 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 353 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -371,7 +375,7 @@ GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qe)
371 stop_job (qe); 375 stop_job (qe);
372 GNUNET_CONTAINER_DLL_remove (h->pending_head, h->pending_tail, qe); 376 GNUNET_CONTAINER_DLL_remove (h->pending_head, h->pending_tail, qe);
373 GNUNET_free (qe); 377 GNUNET_free (qe);
374 if (h->queue_job != NULL) 378 if (NULL != h->queue_job)
375 GNUNET_SCHEDULER_cancel (h->queue_job); 379 GNUNET_SCHEDULER_cancel (h->queue_job);
376 h->queue_job = GNUNET_SCHEDULER_add_now (&process_job_queue, h); 380 h->queue_job = GNUNET_SCHEDULER_add_now (&process_job_queue, h);
377} 381}
@@ -3039,11 +3043,12 @@ deserialize_download_file (void *cls, const char *filename)
3039 * Deserialize informatin about pending operations. 3043 * Deserialize informatin about pending operations.
3040 * 3044 *
3041 * @param master_path which master directory should be scanned 3045 * @param master_path which master directory should be scanned
3042 * @param proc function to call for each entry (will get 'h' for 'cls') 3046 * @param proc function to call for each entry (will get @a h for 'cls')
3043 * @param h the 'struct GNUNET_FS_Handle*' 3047 * @param h the `struct GNUNET_FS_Handle *`
3044 */ 3048 */
3045static void 3049static void
3046deserialization_master (const char *master_path, GNUNET_FileNameCallback proc, 3050deserialization_master (const char *master_path,
3051 GNUNET_FileNameCallback proc,
3047 struct GNUNET_FS_Handle *h) 3052 struct GNUNET_FS_Handle *h)
3048{ 3053{
3049 char *dn; 3054 char *dn;
@@ -3127,17 +3132,19 @@ GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
3127 3132
3128/** 3133/**
3129 * Close our connection with the file-sharing service. 3134 * Close our connection with the file-sharing service.
3130 * The callback given to GNUNET_FS_start will no longer be 3135 * The callback given to #GNUNET_FS_start() will no longer be
3131 * called after this function returns. 3136 * called after this function returns.
3137 * This function MUST NOT be called from within the
3138 * callback itself.
3132 * 3139 *
3133 * @param h handle that was returned from #GNUNET_FS_start() 3140 * @param h handle that was returned from #GNUNET_FS_start()
3134 */ 3141 */
3135void 3142void
3136GNUNET_FS_stop (struct GNUNET_FS_Handle *h) 3143GNUNET_FS_stop (struct GNUNET_FS_Handle *h)
3137{ 3144{
3138 while (h->top_head != NULL) 3145 while (NULL != h->top_head)
3139 h->top_head->ssf (h->top_head->ssf_cls); 3146 h->top_head->ssf (h->top_head->ssf_cls);
3140 if (h->queue_job != NULL) 3147 if (NULL != h->queue_job)
3141 GNUNET_SCHEDULER_cancel (h->queue_job); 3148 GNUNET_SCHEDULER_cancel (h->queue_job);
3142 GNUNET_free (h->client_name); 3149 GNUNET_free (h->client_name);
3143 GNUNET_free (h); 3150 GNUNET_free (h);