- {
- /* ugh, request 'timed out' -- how can this be? */
- GNUNET_break (0);
- GNUNET_assert (GNUNET_NO == more);
- return;
- }
- /* FIXME: adapt old code below to new API! */
-
- GNUNET_STATISTICS_update (stats,
- gettext_noop ("# replies received for local clients"),
- 1,
- GNUNET_NO);
- cl = pr->client_request_list->client_list;
- msize = sizeof (struct PutMessage) + prq->size;
- creply = GNUNET_malloc (msize + sizeof (struct ClientResponseMessage));
- creply->msize = msize;
- creply->client_list = cl;
- GNUNET_CONTAINER_DLL_insert_after (cl->res_head,
- cl->res_tail,
- cl->res_tail,
- creply);
- pm = (struct PutMessage*) &creply[1];
- pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
- pm->header.size = htons (msize);
- pm->type = htonl (prq->type);
- pm->expiration = GNUNET_TIME_absolute_hton (prq->expiration);
- memcpy (&pm[1], prq->data, prq->size);
- if (NULL == cl->th)
- {
-#if DEBUG_FS
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmitting result for query `%s' to client\n",
- GNUNET_h2s (key));
-#endif
- cl->th = GNUNET_SERVER_notify_transmit_ready (cl->client,
- msize,
- GNUNET_TIME_UNIT_FOREVER_REL,
- &transmit_to_client,
- cl);
- }
- GNUNET_break (cl->th != NULL);
- if (pr->do_remove)
- {
- prq->finished = GNUNET_YES;
- destroy_pending_request (pr);
- }
-
+ {
+ /* ugh, request 'timed out' -- how can this be? */
+ GNUNET_break (0);
+ return;
+ }
+ prd = GSF_pending_request_get_data_ (pr);
+ GNUNET_break (type != GNUNET_BLOCK_TYPE_ANY);
+ if ((prd->type != type) && (prd->type != GNUNET_BLOCK_TYPE_ANY))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ GNUNET_STATISTICS_update (GSF_stats,
+ gettext_noop
+ ("# replies received for local clients"), 1,
+ GNUNET_NO);
+ GNUNET_assert (pr == cr->pr);
+ lc = cr->lc;
+ msize = sizeof (struct ClientPutMessage) + data_len;
+ {
+ char buf[msize] GNUNET_ALIGN;
+
+ pm = (struct ClientPutMessage *) buf;
+ pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
+ pm->header.size = htons (msize);
+ pm->type = htonl (type);
+ pm->expiration = GNUNET_TIME_absolute_hton (expiration);
+ pm->last_transmission = GNUNET_TIME_absolute_hton (last_transmission);
+ pm->num_transmissions = htonl (prd->num_transmissions);
+ pm->respect_offered = htonl (prd->respect_offered);
+ memcpy (&pm[1], data, data_len);
+ GSF_local_client_transmit_ (lc, &pm->header);
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Queued reply to query `%s' for local client\n",
+ GNUNET_h2s (&prd->query), (unsigned int) prd->type);
+ if (GNUNET_BLOCK_EVALUATION_OK_LAST != eval)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Evaluation %d - keeping query alive\n",
+ (int) eval);
+ return;
+ }
+ if (GNUNET_SCHEDULER_NO_TASK == cr->kill_task)
+ cr->kill_task = GNUNET_SCHEDULER_add_now (&client_request_destroy, cr);