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/fs/gnunet-unindex.c | |
parent | 7217c601ad30760872823193d62307e7a335d226 (diff) | |
download | gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.tar.gz gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.zip |
big scheduler refactoring, expect some issues
Diffstat (limited to 'src/fs/gnunet-unindex.c')
-rw-r--r-- | src/fs/gnunet-unindex.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c index 872aa3d3a..f73d2f0cc 100644 --- a/src/fs/gnunet-unindex.c +++ b/src/fs/gnunet-unindex.c | |||
@@ -38,8 +38,6 @@ static struct GNUNET_FS_Handle *ctx; | |||
38 | 38 | ||
39 | static struct GNUNET_FS_UnindexContext *uc; | 39 | static struct GNUNET_FS_UnindexContext *uc; |
40 | 40 | ||
41 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
42 | |||
43 | 41 | ||
44 | static void | 42 | static void |
45 | cleanup_task (void *cls, | 43 | cleanup_task (void *cls, |
@@ -103,16 +101,15 @@ progress_cb (void *cls, | |||
103 | fprintf (stderr, | 101 | fprintf (stderr, |
104 | _("Error unindexing: %s.\n"), | 102 | _("Error unindexing: %s.\n"), |
105 | info->value.unindex.specifics.error.message); | 103 | info->value.unindex.specifics.error.message); |
106 | GNUNET_SCHEDULER_shutdown (sched); | 104 | GNUNET_SCHEDULER_shutdown (); |
107 | break; | 105 | break; |
108 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: | 106 | case GNUNET_FS_STATUS_UNINDEX_COMPLETED: |
109 | fprintf (stdout, | 107 | fprintf (stdout, |
110 | _("Unindexing done.\n")); | 108 | _("Unindexing done.\n")); |
111 | GNUNET_SCHEDULER_shutdown (sched); | 109 | GNUNET_SCHEDULER_shutdown (); |
112 | break; | 110 | break; |
113 | case GNUNET_FS_STATUS_UNINDEX_STOPPED: | 111 | case GNUNET_FS_STATUS_UNINDEX_STOPPED: |
114 | GNUNET_SCHEDULER_add_continuation (sched, | 112 | GNUNET_SCHEDULER_add_continuation (&cleanup_task, |
115 | &cleanup_task, | ||
116 | NULL, | 113 | NULL, |
117 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 114 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
118 | break; | 115 | break; |
@@ -130,14 +127,12 @@ progress_cb (void *cls, | |||
130 | * Main function that will be run by the scheduler. | 127 | * Main function that will be run by the scheduler. |
131 | * | 128 | * |
132 | * @param cls closure | 129 | * @param cls closure |
133 | * @param s the scheduler to use | ||
134 | * @param args remaining command-line arguments | 130 | * @param args remaining command-line arguments |
135 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 131 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
136 | * @param c configuration | 132 | * @param c configuration |
137 | */ | 133 | */ |
138 | static void | 134 | static void |
139 | run (void *cls, | 135 | run (void *cls, |
140 | struct GNUNET_SCHEDULER_Handle *s, | ||
141 | char *const *args, | 136 | char *const *args, |
142 | const char *cfgfile, | 137 | const char *cfgfile, |
143 | const struct GNUNET_CONFIGURATION_Handle *c) | 138 | const struct GNUNET_CONFIGURATION_Handle *c) |
@@ -150,10 +145,8 @@ run (void *cls, | |||
150 | ret = -1; | 145 | ret = -1; |
151 | return; | 146 | return; |
152 | } | 147 | } |
153 | sched = s; | ||
154 | cfg = c; | 148 | cfg = c; |
155 | ctx = GNUNET_FS_start (sched, | 149 | ctx = GNUNET_FS_start (cfg, |
156 | cfg, | ||
157 | "gnunet-unindex", | 150 | "gnunet-unindex", |
158 | &progress_cb, | 151 | &progress_cb, |
159 | NULL, | 152 | NULL, |
@@ -177,8 +170,7 @@ run (void *cls, | |||
177 | GNUNET_FS_stop (ctx); | 170 | GNUNET_FS_stop (ctx); |
178 | return; | 171 | return; |
179 | } | 172 | } |
180 | GNUNET_SCHEDULER_add_delayed (sched, | 173 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
181 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
182 | &shutdown_task, | 174 | &shutdown_task, |
183 | NULL); | 175 | NULL); |
184 | } | 176 | } |