aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_lc.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-02-10 12:59:38 +0000
committerChristian Grothoff <christian@grothoff.org>2011-02-10 12:59:38 +0000
commitf54389f6724ecbd39389d53fba7b3bfdb2e0a8eb (patch)
tree11a7156180b22e4eaf784f5b1e400261c00e3ef9 /src/fs/gnunet-service-fs_lc.c
parent3a39cd4cd22e345733ba225e7a4c0b6eecdad7df (diff)
downloadgnunet-f54389f6724ecbd39389d53fba7b3bfdb2e0a8eb.tar.gz
gnunet-f54389f6724ecbd39389d53fba7b3bfdb2e0a8eb.zip
stuff
Diffstat (limited to 'src/fs/gnunet-service-fs_lc.c')
-rw-r--r--src/fs/gnunet-service-fs_lc.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c
index 9c9c0d568..ea33580f9 100644
--- a/src/fs/gnunet-service-fs_lc.c
+++ b/src/fs/gnunet-service-fs_lc.c
@@ -179,6 +179,70 @@ GSF_local_client_lookup_ (struct GNUNET_SERVER_Client *client)
179 179
180 180
181/** 181/**
182 * Handle a reply to a pending request. Also called if a request
183 * expires (then with data == NULL). The handler may be called
184 * many times (depending on the request type), but will not be
185 * called during or after a call to GSF_pending_request_cancel
186 * and will also not be called anymore after a call signalling
187 * expiration.
188 *
189 * @param cls user-specified closure
190 * @param pr handle to the original pending request
191 * @param data response data, NULL on request expiration
192 * @param data_len number of bytes in data
193 */
194static void
195client_response_handler (void *cls,
196 struct GSF_PendingRequest *pr,
197 const void *data,
198 size_t data_len)
199{
200 /* FIXME: adapt old code below to new API! */
201
202 GNUNET_STATISTICS_update (stats,
203 gettext_noop ("# replies received for local clients"),
204 1,
205 GNUNET_NO);
206 cl = pr->client_request_list->client_list;
207 msize = sizeof (struct PutMessage) + prq->size;
208 creply = GNUNET_malloc (msize + sizeof (struct ClientResponseMessage));
209 creply->msize = msize;
210 creply->client_list = cl;
211 GNUNET_CONTAINER_DLL_insert_after (cl->res_head,
212 cl->res_tail,
213 cl->res_tail,
214 creply);
215 pm = (struct PutMessage*) &creply[1];
216 pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
217 pm->header.size = htons (msize);
218 pm->type = htonl (prq->type);
219 pm->expiration = GNUNET_TIME_absolute_hton (prq->expiration);
220 memcpy (&pm[1], prq->data, prq->size);
221 if (NULL == cl->th)
222 {
223#if DEBUG_FS
224 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
225 "Transmitting result for query `%s' to client\n",
226 GNUNET_h2s (key));
227#endif
228 cl->th = GNUNET_SERVER_notify_transmit_ready (cl->client,
229 msize,
230 GNUNET_TIME_UNIT_FOREVER_REL,
231 &transmit_to_client,
232 cl);
233 }
234 GNUNET_break (cl->th != NULL);
235 if (pr->do_remove)
236 {
237 prq->finished = GNUNET_YES;
238 destroy_pending_request (pr);
239 }
240
241}
242
243
244
245/**
182 * Handle START_SEARCH-message (search request from local client). 246 * Handle START_SEARCH-message (search request from local client).
183 * 247 *
184 * @param client identification of the client 248 * @param client identification of the client