aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_lc.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-04-21 15:14:14 +0000
committerChristian Grothoff <christian@grothoff.org>2011-04-21 15:14:14 +0000
commit41700b6cb0345080513d82bdbe2dbe33c8654491 (patch)
treefeab3a7f27cdadd01897239c86cbdd137da55b8f /src/fs/gnunet-service-fs_lc.c
parentbbf3c4e04289295df264539e1017f3778f45f97f (diff)
downloadgnunet-41700b6cb0345080513d82bdbe2dbe33c8654491.tar.gz
gnunet-41700b6cb0345080513d82bdbe2dbe33c8654491.zip
wip
Diffstat (limited to 'src/fs/gnunet-service-fs_lc.c')
-rw-r--r--src/fs/gnunet-service-fs_lc.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c
index 58a1a0933..15dd4897a 100644
--- a/src/fs/gnunet-service-fs_lc.c
+++ b/src/fs/gnunet-service-fs_lc.c
@@ -58,6 +58,11 @@ struct ClientRequest
58 */ 58 */
59 struct GSF_LocalClient *lc; 59 struct GSF_LocalClient *lc;
60 60
61 /**
62 * Task scheduled to destroy the request.
63 */
64 GNUNET_SCHEDULER_TaskIdentifier kill_task;
65
61}; 66};
62 67
63 68
@@ -180,6 +185,33 @@ GSF_local_client_lookup_ (struct GNUNET_SERVER_Client *client)
180 185
181 186
182/** 187/**
188 * Free the given client request.
189 *
190 * @param cls the client request to free
191 * @param tc task context
192 */
193static void
194client_request_destroy (void *cls,
195 const struct GNUNET_SCHEDULER_TaskContext *tc)
196{
197 struct ClientRequest *cr = cls;
198 struct GSF_LocalClient *lc;
199
200 cr->kill_task = GNUNET_SCHEDULER_NO_TASK;
201 lc = cr->lc;
202 GNUNET_CONTAINER_DLL_remove (lc->cr_head,
203 lc->cr_tail,
204 cr);
205 GSF_pending_request_cancel_ (cr->pr);
206 GNUNET_STATISTICS_update (GSF_stats,
207 gettext_noop ("# client searches active"),
208 - 1,
209 GNUNET_NO);
210 GNUNET_free (cr);
211}
212
213
214/**
183 * Handle a reply to a pending request. Also called if a request 215 * Handle a reply to a pending request. Also called if a request
184 * expires (then with data == NULL). The handler may be called 216 * expires (then with data == NULL). The handler may be called
185 * many times (depending on the request type), but will not be 217 * many times (depending on the request type), but will not be
@@ -246,16 +278,8 @@ client_response_handler (void *cls,
246#endif 278#endif
247 if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST) 279 if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST)
248 return; 280 return;
249 GNUNET_CONTAINER_DLL_remove (lc->cr_head, 281 cr->kill_task = GNUNET_SCHEDULER_add_now (&client_request_destroy,
250 lc->cr_tail, 282 cr);
251 cr);
252 GSF_pending_request_cancel_ (cr->pr);
253 GNUNET_STATISTICS_update (GSF_stats,
254 gettext_noop ("# client searches active"),
255 - 1,
256 GNUNET_NO);
257 GNUNET_free (cr);
258
259} 283}
260 284
261 285
@@ -489,6 +513,8 @@ GSF_client_disconnect_handler_ (void *cls,
489 gettext_noop ("# client searches active"), 513 gettext_noop ("# client searches active"),
490 - 1, 514 - 1,
491 GNUNET_NO); 515 GNUNET_NO);
516 if (GNUNET_SCHEDULER_NO_TASK != cr->kill_task)
517 GNUNET_SCHEDULER_cancel (cr->kill_task);
492 GNUNET_free (cr); 518 GNUNET_free (cr);
493 } 519 }
494 while (NULL != (res = pos->res_head)) 520 while (NULL != (res = pos->res_head))