gnunet-service-fs_lc.c | gnunet-service-fs_lc.c | |||
---|---|---|---|---|
skipping to change at line 213 | skipping to change at line 213 | |||
* many times (depending on the request type), but will not be | * many times (depending on the request type), but will not be | |||
* called during or after a call to GSF_pending_request_cancel | * called during or after a call to GSF_pending_request_cancel | |||
* and will also not be called anymore after a call signalling | * and will also not be called anymore after a call signalling | |||
* expiration. | * expiration. | |||
* | * | |||
* @param cls user-specified closure | * @param cls user-specified closure | |||
* @param eval evaluation of the result | * @param eval evaluation of the result | |||
* @param pr handle to the original pending request | * @param pr handle to the original pending request | |||
* @param reply_anonymity_level anonymity level for the reply, UINT32_MAX f or "unknown" | * @param reply_anonymity_level anonymity level for the reply, UINT32_MAX f or "unknown" | |||
* @param expiration when does 'data' expire? | * @param expiration when does 'data' expire? | |||
* @param last_transmission when was the last time we've tried to download this block? (FOREVER if unknown) | ||||
* @param type type of the block | * @param type type of the block | |||
* @param data response data, NULL on request expiration | * @param data response data, NULL on request expiration | |||
* @param data_len number of bytes in data | * @param data_len number of bytes in data | |||
*/ | */ | |||
static void | static void | |||
client_response_handler (void *cls, enum GNUNET_BLOCK_EvaluationResult eval , | client_response_handler (void *cls, enum GNUNET_BLOCK_EvaluationResult eval , | |||
struct GSF_PendingRequest *pr, | struct GSF_PendingRequest *pr, | |||
uint32_t reply_anonymity_level, | uint32_t reply_anonymity_level, | |||
struct GNUNET_TIME_Absolute expiration, | struct GNUNET_TIME_Absolute expiration, | |||
struct GNUNET_TIME_Absolute last_transmission, | ||||
enum GNUNET_BLOCK_Type type, const void *data, | enum GNUNET_BLOCK_Type type, const void *data, | |||
size_t data_len) | size_t data_len) | |||
{ | { | |||
struct ClientRequest *cr = cls; | struct ClientRequest *cr = cls; | |||
struct GSF_LocalClient *lc; | struct GSF_LocalClient *lc; | |||
struct PutMessage *pm; | struct ClientPutMessage *pm; | |||
const struct GSF_PendingRequestData *prd; | const struct GSF_PendingRequestData *prd; | |||
size_t msize; | size_t msize; | |||
if (NULL == data) | if (NULL == data) | |||
{ | { | |||
/* ugh, request 'timed out' -- how can this be? */ | /* ugh, request 'timed out' -- how can this be? */ | |||
GNUNET_break (0); | GNUNET_break (0); | |||
return; | return; | |||
} | } | |||
prd = GSF_pending_request_get_data_ (pr); | prd = GSF_pending_request_get_data_ (pr); | |||
skipping to change at line 250 | skipping to change at line 252 | |||
{ | { | |||
GNUNET_break (0); | GNUNET_break (0); | |||
return; | return; | |||
} | } | |||
GNUNET_STATISTICS_update (GSF_stats, | GNUNET_STATISTICS_update (GSF_stats, | |||
gettext_noop | gettext_noop | |||
("# replies received for local clients"), 1, | ("# replies received for local clients"), 1, | |||
GNUNET_NO); | GNUNET_NO); | |||
GNUNET_assert (pr == cr->pr); | GNUNET_assert (pr == cr->pr); | |||
lc = cr->lc; | lc = cr->lc; | |||
msize = sizeof (struct PutMessage) + data_len; | msize = sizeof (struct ClientPutMessage) + data_len; | |||
{ | { | |||
char buf[msize]; | char buf[msize]; | |||
pm = (struct PutMessage *) buf; | pm = (struct ClientPutMessage *) buf; | |||
pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT); | pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT); | |||
pm->header.size = htons (msize); | pm->header.size = htons (msize); | |||
pm->type = htonl (type); | pm->type = htonl (type); | |||
pm->expiration = GNUNET_TIME_absolute_hton (expiration); | pm->expiration = GNUNET_TIME_absolute_hton (expiration); | |||
pm->last_transmission = GNUNET_TIME_absolute_hton (last_transmission); | ||||
memcpy (&pm[1], data, data_len); | memcpy (&pm[1], data, data_len); | |||
GSF_local_client_transmit_ (lc, &pm->header); | GSF_local_client_transmit_ (lc, &pm->header); | |||
} | } | |||
#if DEBUG_FS_CLIENT | ||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |||
"Queued reply to query `%s' for local client\n", | "Queued reply to query `%s' for local client\n", | |||
GNUNET_h2s (&prd->query), (unsigned int) prd->type); | GNUNET_h2s (&prd->query), (unsigned int) prd->type); | |||
#endif | ||||
if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST) | if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST) | |||
return; | return; | |||
cr->kill_task = GNUNET_SCHEDULER_add_now (&client_request_destroy, cr); | if (GNUNET_SCHEDULER_NO_TASK != cr->kill_task) | |||
cr->kill_task = GNUNET_SCHEDULER_add_now (&client_request_destroy, cr); | ||||
} | } | |||
/** | /** | |||
* Handle START_SEARCH-message (search request from local client). | * Handle START_SEARCH-message (search request from local client). | |||
* Only responsible for creating the request entry itself and setting | * Only responsible for creating the request entry itself and setting | |||
* up reply callback and cancellation on client disconnect. Does NOT | * up reply callback and cancellation on client disconnect. Does NOT | |||
* execute the actual request strategy (planning). | * execute the actual request strategy (planning). | |||
* | * | |||
* @param client identification of the client | * @param client identification of the client | |||
* @param message the actual message | * @param message the actual message | |||
skipping to change at line 315 | skipping to change at line 317 | |||
GNUNET_break (0); | GNUNET_break (0); | |||
*prptr = NULL; | *prptr = NULL; | |||
return GNUNET_SYSERR; | return GNUNET_SYSERR; | |||
} | } | |||
GNUNET_STATISTICS_update (GSF_stats, | GNUNET_STATISTICS_update (GSF_stats, | |||
gettext_noop ("# client searches received"), 1, | gettext_noop ("# client searches received"), 1, | |||
GNUNET_NO); | GNUNET_NO); | |||
sc = (msize - sizeof (struct SearchMessage)) / sizeof (GNUNET_HashCode); | sc = (msize - sizeof (struct SearchMessage)) / sizeof (GNUNET_HashCode); | |||
sm = (const struct SearchMessage *) message; | sm = (const struct SearchMessage *) message; | |||
type = ntohl (sm->type); | type = ntohl (sm->type); | |||
#if DEBUG_FS_CLIENT | ||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |||
"Received request for `%s' of type %u from local client\n", | "Received request for `%s' of type %u from local client\n", | |||
GNUNET_h2s (&sm->query), (unsigned int) type); | GNUNET_h2s (&sm->query), (unsigned int) type); | |||
#endif | ||||
lc = GSF_local_client_lookup_ (client); | lc = GSF_local_client_lookup_ (client); | |||
cr = NULL; | cr = NULL; | |||
/* detect duplicate KBLOCK requests */ | /* detect duplicate KBLOCK requests */ | |||
if ((type == GNUNET_BLOCK_TYPE_FS_KBLOCK) || | if ((type == GNUNET_BLOCK_TYPE_FS_KBLOCK) || | |||
(type == GNUNET_BLOCK_TYPE_FS_NBLOCK) || (type == GNUNET_BLOCK_TYPE_A NY)) | (type == GNUNET_BLOCK_TYPE_FS_NBLOCK) || (type == GNUNET_BLOCK_TYPE_A NY)) | |||
{ | { | |||
cr = lc->cr_head; | cr = lc->cr_head; | |||
while (cr != NULL) | while (cr != NULL) | |||
{ | { | |||
prd = GSF_pending_request_get_data_ (cr->pr); | prd = GSF_pending_request_get_data_ (cr->pr); | |||
skipping to change at line 342 | skipping to change at line 342 | |||
matching query and type */ | matching query and type */ | |||
if ((GNUNET_YES != prd->has_started) && | if ((GNUNET_YES != prd->has_started) && | |||
(0 != memcmp (&prd->query, &sm->query, sizeof (GNUNET_HashCode))) && | (0 != memcmp (&prd->query, &sm->query, sizeof (GNUNET_HashCode))) && | |||
(prd->type == type)) | (prd->type == type)) | |||
break; | break; | |||
cr = cr->next; | cr = cr->next; | |||
} | } | |||
} | } | |||
if (cr != NULL) | if (cr != NULL) | |||
{ | { | |||
#if DEBUG_FS_CLIENT | ||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |||
"Have existing request, merging content-seen lists.\n"); | "Have existing request, merging content-seen lists.\n"); | |||
#endif | ||||
GSF_pending_request_update_ (cr->pr, (const GNUNET_HashCode *) &sm[1], sc); | GSF_pending_request_update_ (cr->pr, (const GNUNET_HashCode *) &sm[1], sc); | |||
GNUNET_STATISTICS_update (GSF_stats, | GNUNET_STATISTICS_update (GSF_stats, | |||
gettext_noop | gettext_noop | |||
("# client searches updated (merged content s een list)"), | ("# client searches updated (merged content s een list)"), | |||
1, GNUNET_NO); | 1, GNUNET_NO); | |||
} | } | |||
else | else | |||
{ | { | |||
GNUNET_STATISTICS_update (GSF_stats, | GNUNET_STATISTICS_update (GSF_stats, | |||
gettext_noop ("# client searches active"), 1, | gettext_noop ("# client searches active"), 1, | |||
End of changes. 13 change blocks. | ||||
10 lines changed or deleted | 8 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |