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/peerinfo/peerinfo_api_notify.c | |
parent | 7217c601ad30760872823193d62307e7a335d226 (diff) | |
download | gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.tar.gz gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.zip |
big scheduler refactoring, expect some issues
Diffstat (limited to 'src/peerinfo/peerinfo_api_notify.c')
-rw-r--r-- | src/peerinfo/peerinfo_api_notify.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/peerinfo/peerinfo_api_notify.c b/src/peerinfo/peerinfo_api_notify.c index c7a9c6145..25f2b9d5e 100644 --- a/src/peerinfo/peerinfo_api_notify.c +++ b/src/peerinfo/peerinfo_api_notify.c | |||
@@ -62,10 +62,6 @@ struct GNUNET_PEERINFO_NotifyContext | |||
62 | */ | 62 | */ |
63 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 63 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
64 | 64 | ||
65 | /** | ||
66 | * Scheduler. | ||
67 | */ | ||
68 | struct GNUNET_SCHEDULER_Handle *sched; | ||
69 | }; | 65 | }; |
70 | 66 | ||
71 | 67 | ||
@@ -109,7 +105,7 @@ process_notification (void *cls, | |||
109 | if (msg == NULL) | 105 | if (msg == NULL) |
110 | { | 106 | { |
111 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); | 107 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); |
112 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); | 108 | nc->client = GNUNET_CLIENT_connect ("peerinfo", nc->cfg); |
113 | request_notifications (nc); | 109 | request_notifications (nc); |
114 | return; | 110 | return; |
115 | } | 111 | } |
@@ -119,7 +115,7 @@ process_notification (void *cls, | |||
119 | { | 115 | { |
120 | GNUNET_break (0); | 116 | GNUNET_break (0); |
121 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); | 117 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); |
122 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); | 118 | nc->client = GNUNET_CLIENT_connect ("peerinfo", nc->cfg); |
123 | request_notifications (nc); | 119 | request_notifications (nc); |
124 | return; | 120 | return; |
125 | } | 121 | } |
@@ -132,7 +128,7 @@ process_notification (void *cls, | |||
132 | { | 128 | { |
133 | GNUNET_break (0); | 129 | GNUNET_break (0); |
134 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); | 130 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); |
135 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); | 131 | nc->client = GNUNET_CLIENT_connect ("peerinfo", nc->cfg); |
136 | request_notifications (nc); | 132 | request_notifications (nc); |
137 | return; | 133 | return; |
138 | } | 134 | } |
@@ -183,7 +179,7 @@ transmit_notify_request (void *cls, | |||
183 | if (buf == NULL) | 179 | if (buf == NULL) |
184 | { | 180 | { |
185 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); | 181 | GNUNET_CLIENT_disconnect (nc->client, GNUNET_NO); |
186 | nc->client = GNUNET_CLIENT_connect (nc->sched, "peerinfo", nc->cfg); | 182 | nc->client = GNUNET_CLIENT_connect ("peerinfo", nc->cfg); |
187 | request_notifications (nc); | 183 | request_notifications (nc); |
188 | return 0; | 184 | return 0; |
189 | } | 185 | } |
@@ -221,21 +217,19 @@ request_notifications (struct GNUNET_PEERINFO_NotifyContext *nc) | |||
221 | * peers and then only signals changes. | 217 | * peers and then only signals changes. |
222 | * | 218 | * |
223 | * @param cfg configuration to use | 219 | * @param cfg configuration to use |
224 | * @param sched scheduler to use | ||
225 | * @param callback the method to call for each peer | 220 | * @param callback the method to call for each peer |
226 | * @param callback_cls closure for callback | 221 | * @param callback_cls closure for callback |
227 | * @return NULL on error | 222 | * @return NULL on error |
228 | */ | 223 | */ |
229 | struct GNUNET_PEERINFO_NotifyContext * | 224 | struct GNUNET_PEERINFO_NotifyContext * |
230 | GNUNET_PEERINFO_notify (const struct GNUNET_CONFIGURATION_Handle *cfg, | 225 | GNUNET_PEERINFO_notify (const struct GNUNET_CONFIGURATION_Handle *cfg, |
231 | struct GNUNET_SCHEDULER_Handle *sched, | ||
232 | GNUNET_PEERINFO_Processor callback, | 226 | GNUNET_PEERINFO_Processor callback, |
233 | void *callback_cls) | 227 | void *callback_cls) |
234 | { | 228 | { |
235 | struct GNUNET_PEERINFO_NotifyContext *nc; | 229 | struct GNUNET_PEERINFO_NotifyContext *nc; |
236 | struct GNUNET_CLIENT_Connection *client; | 230 | struct GNUNET_CLIENT_Connection *client; |
237 | 231 | ||
238 | client = GNUNET_CLIENT_connect (sched, "peerinfo", cfg); | 232 | client = GNUNET_CLIENT_connect ("peerinfo", cfg); |
239 | if (client == NULL) | 233 | if (client == NULL) |
240 | { | 234 | { |
241 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 235 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -243,7 +237,6 @@ GNUNET_PEERINFO_notify (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
243 | return NULL; | 237 | return NULL; |
244 | } | 238 | } |
245 | nc = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_NotifyContext)); | 239 | nc = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_NotifyContext)); |
246 | nc->sched = sched; | ||
247 | nc->cfg = cfg; | 240 | nc->cfg = cfg; |
248 | nc->client = client; | 241 | nc->client = client; |
249 | nc->callback = callback; | 242 | nc->callback = callback; |