diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-11-05 18:21:50 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-11-05 18:21:50 +0000 |
commit | 75a33a1499cf60ea4364c9aa673816629a6c1413 (patch) | |
tree | 0620da4312bb04de4d7b65074fdd3b0c3dd6cc0e /src/statistics/statistics_api.c | |
parent | 7217c601ad30760872823193d62307e7a335d226 (diff) | |
download | gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.tar.gz gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.zip |
big scheduler refactoring, expect some issues
Diffstat (limited to 'src/statistics/statistics_api.c')
-rw-r--r-- | src/statistics/statistics_api.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/statistics/statistics_api.c b/src/statistics/statistics_api.c index ef9865e02..5bca6c786 100644 --- a/src/statistics/statistics_api.c +++ b/src/statistics/statistics_api.c | |||
@@ -167,11 +167,6 @@ struct GNUNET_STATISTICS_GetHandle | |||
167 | struct GNUNET_STATISTICS_Handle | 167 | struct GNUNET_STATISTICS_Handle |
168 | { | 168 | { |
169 | /** | 169 | /** |
170 | * Our scheduler. | ||
171 | */ | ||
172 | struct GNUNET_SCHEDULER_Handle *sched; | ||
173 | |||
174 | /** | ||
175 | * Name of our subsystem. | 170 | * Name of our subsystem. |
176 | */ | 171 | */ |
177 | char *subsystem; | 172 | char *subsystem; |
@@ -318,7 +313,7 @@ try_connect (struct GNUNET_STATISTICS_Handle *ret) | |||
318 | unsigned int i; | 313 | unsigned int i; |
319 | if (ret->client != NULL) | 314 | if (ret->client != NULL) |
320 | return GNUNET_YES; | 315 | return GNUNET_YES; |
321 | ret->client = GNUNET_CLIENT_connect (ret->sched, "statistics", ret->cfg); | 316 | ret->client = GNUNET_CLIENT_connect ("statistics", ret->cfg); |
322 | if (ret->client != NULL) | 317 | if (ret->client != NULL) |
323 | { | 318 | { |
324 | for (i=0;i<ret->watches_size;i++) | 319 | for (i=0;i<ret->watches_size;i++) |
@@ -727,23 +722,19 @@ transmit_action (void *cls, size_t size, void *buf) | |||
727 | /** | 722 | /** |
728 | * Get handle for the statistics service. | 723 | * Get handle for the statistics service. |
729 | * | 724 | * |
730 | * @param sched scheduler to use | ||
731 | * @param subsystem name of subsystem using the service | 725 | * @param subsystem name of subsystem using the service |
732 | * @param cfg services configuration in use | 726 | * @param cfg services configuration in use |
733 | * @return handle to use | 727 | * @return handle to use |
734 | */ | 728 | */ |
735 | struct GNUNET_STATISTICS_Handle * | 729 | struct GNUNET_STATISTICS_Handle * |
736 | GNUNET_STATISTICS_create (struct GNUNET_SCHEDULER_Handle *sched, | 730 | GNUNET_STATISTICS_create (const char *subsystem, |
737 | const char *subsystem, | ||
738 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 731 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
739 | { | 732 | { |
740 | struct GNUNET_STATISTICS_Handle *ret; | 733 | struct GNUNET_STATISTICS_Handle *ret; |
741 | 734 | ||
742 | GNUNET_assert (subsystem != NULL); | 735 | GNUNET_assert (subsystem != NULL); |
743 | GNUNET_assert (sched != NULL); | ||
744 | GNUNET_assert (cfg != NULL); | 736 | GNUNET_assert (cfg != NULL); |
745 | ret = GNUNET_malloc (sizeof (struct GNUNET_STATISTICS_Handle)); | 737 | ret = GNUNET_malloc (sizeof (struct GNUNET_STATISTICS_Handle)); |
746 | ret->sched = sched; | ||
747 | ret->cfg = cfg; | 738 | ret->cfg = cfg; |
748 | ret->subsystem = GNUNET_strdup (subsystem); | 739 | ret->subsystem = GNUNET_strdup (subsystem); |
749 | ret->backoff = GNUNET_TIME_UNIT_MILLISECONDS; | 740 | ret->backoff = GNUNET_TIME_UNIT_MILLISECONDS; |
@@ -771,8 +762,7 @@ GNUNET_STATISTICS_destroy (struct GNUNET_STATISTICS_Handle *h, | |||
771 | int i; | 762 | int i; |
772 | 763 | ||
773 | if (GNUNET_SCHEDULER_NO_TASK != h->backoff_task) | 764 | if (GNUNET_SCHEDULER_NO_TASK != h->backoff_task) |
774 | GNUNET_SCHEDULER_cancel (h->sched, | 765 | GNUNET_SCHEDULER_cancel (h->backoff_task); |
775 | h->backoff_task); | ||
776 | if (sync_first) | 766 | if (sync_first) |
777 | { | 767 | { |
778 | if (h->current != NULL) | 768 | if (h->current != NULL) |
@@ -884,8 +874,7 @@ schedule_action (struct GNUNET_STATISTICS_Handle *h) | |||
884 | return; /* action already pending */ | 874 | return; /* action already pending */ |
885 | if (GNUNET_YES != try_connect (h)) | 875 | if (GNUNET_YES != try_connect (h)) |
886 | { | 876 | { |
887 | h->backoff_task = GNUNET_SCHEDULER_add_delayed (h->sched, | 877 | h->backoff_task = GNUNET_SCHEDULER_add_delayed (h->backoff, |
888 | h->backoff, | ||
889 | &finish_task, | 878 | &finish_task, |
890 | h); | 879 | h); |
891 | h->backoff = GNUNET_TIME_relative_multiply (h->backoff, 2); | 880 | h->backoff = GNUNET_TIME_relative_multiply (h->backoff, 2); |