From fbdce8d7a2ec33531a6c1f27bfccf81865bc9a7d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 5 Dec 2012 19:33:59 +0000 Subject: -more logging --- src/fs/fs_api.c | 29 ++++++++++++++++++++++------- src/fs/fs_api.h | 5 +++-- src/fs/fs_download.c | 9 +++++++++ src/fs/fs_search.c | 13 +++++++++++++ 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index f03cdb8e4..678187a27 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c @@ -61,6 +61,10 @@ start_job (struct GNUNET_FS_QueueEntry *qe) qe->h->active_blocks += qe->blocks; qe->h->active_downloads++; qe->start_time = GNUNET_TIME_absolute_get (); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Starting job %p (%u active)\n", + qe, + qe->h->active_downloads); GNUNET_CONTAINER_DLL_remove (qe->h->pending_head, qe->h->pending_tail, qe); GNUNET_CONTAINER_DLL_insert_after (qe->h->running_head, qe->h->running_tail, qe->h->running_tail, qe); @@ -85,6 +89,10 @@ stop_job (struct GNUNET_FS_QueueEntry *qe) GNUNET_TIME_relative_add (qe->run_time, GNUNET_TIME_absolute_get_duration (qe->start_time)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Stopping job %p (%u active)\n", + qe, + qe->h->active_downloads); GNUNET_CONTAINER_DLL_remove (qe->h->running_head, qe->h->running_tail, qe); GNUNET_CONTAINER_DLL_insert_after (qe->h->pending_head, qe->h->pending_tail, qe->h->pending_tail, qe); @@ -318,24 +326,31 @@ GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, GNUNET_FS_QueueStart start, if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (h->queue_job); h->queue_job = GNUNET_SCHEDULER_add_now (&process_job_queue, h); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Queueing job %p\n", + qe); return qe; } /** * Dequeue a job from the queue. - * @param qh handle for the job + * + * @param qe handle for the job */ void -GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qh) +GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qe) { struct GNUNET_FS_Handle *h; - h = qh->h; - if (NULL != qh->client) - stop_job (qh); - GNUNET_CONTAINER_DLL_remove (h->pending_head, h->pending_tail, qh); - GNUNET_free (qh); + h = qe->h; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Dequeueing job %p\n", + qe); + if (NULL != qe->client) + stop_job (qe); + GNUNET_CONTAINER_DLL_remove (h->pending_head, h->pending_tail, qe); + GNUNET_free (qe); if (h->queue_job != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (h->queue_job); h->queue_job = GNUNET_SCHEDULER_add_now (&process_job_queue, h); diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h index d4b7aa202..d728c59a0 100644 --- a/src/fs/fs_api.h +++ b/src/fs/fs_api.h @@ -633,10 +633,11 @@ GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, GNUNET_FS_QueueStart start, /** * Dequeue a job from the queue. - * @param qh handle for the job + * + * @param qe handle for the job */ void -GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qh); +GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qe); /** diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index ee301d4d0..c4863fbd2 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -2081,6 +2081,11 @@ create_download_context (struct GNUNET_FS_Handle *h, return NULL; } dc = GNUNET_malloc (sizeof (struct GNUNET_FS_DownloadContext)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Starting download %p, %u bytes at offset %llu\n", + dc, + (unsigned long long) length, + (unsigned long long) offset); dc->h = h; dc->uri = GNUNET_FS_uri_dup (uri); dc->meta = GNUNET_CONTAINER_meta_data_duplicate (meta); @@ -2258,6 +2263,10 @@ GNUNET_FS_download_start_downloading_ (struct GNUNET_FS_DownloadContext *dc) (0 == (dc->options & GNUNET_FS_DOWNLOAD_IS_PROBE)) ? GNUNET_FS_QUEUE_PRIORITY_NORMAL : GNUNET_FS_QUEUE_PRIORITY_PROBE); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Download %p put into queue as job %p\n", + dc, + dc->job_queue); } diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index d7124b68e..5e2ce3604 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c @@ -211,6 +211,10 @@ probe_failure_handler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES); sr->probe_ctx = NULL; GNUNET_FS_search_result_sync_ (sr); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Probe #%u for search result %p failed\n", + sr->availability_trials, + sr); signal_probe_result (sr); } @@ -232,6 +236,10 @@ probe_success_handler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES); sr->probe_ctx = NULL; GNUNET_FS_search_result_sync_ (sr); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Probe #%u for search result %p succeeded\n", + sr->availability_trials, + sr); signal_probe_result (sr); } @@ -361,6 +369,11 @@ GNUNET_FS_search_start_probe_ (struct GNUNET_FS_SearchResult *sr) len = len - off; else len = DBLOCK_SIZE; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Starting probe #%u (at offset %llu) for search result %p\n", + sr->availability_trials + 1, + (unsigned long long) off, + sr); sr->remaining_probe_time = GNUNET_TIME_relative_multiply (sr->sc->h->avg_block_latency, 2 * (1 + sr->availability_trials)); -- cgit v1.2.3