aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-03-25 11:02:34 +0000
committerChristian Grothoff <christian@grothoff.org>2011-03-25 11:02:34 +0000
commitd0b14419851f070e0e6d2ab646e6fc0f4baa08c8 (patch)
tree08b04da9685e21d78c0fac672fb682729ea3f4b4 /src/fs
parent8d9a9ab3714c070341acc2956c55bd039fcf9eaa (diff)
downloadgnunet-d0b14419851f070e0e6d2ab646e6fc0f4baa08c8.tar.gz
gnunet-d0b14419851f070e0e6d2ab646e6fc0f4baa08c8.zip
fix
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/gnunet-service-fs_cp.c11
-rw-r--r--src/fs/gnunet-service-fs_lc.c15
-rw-r--r--src/fs/gnunet-service-fs_pr.c3
-rw-r--r--src/fs/gnunet-service-fs_pr.h2
4 files changed, 27 insertions, 4 deletions
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 9ff96ba36..783bd4024 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -560,6 +560,7 @@ copy_reply (void *cls,
560 * have liked an answer to the request 560 * have liked an answer to the request
561 * @param pr handle to the original pending request 561 * @param pr handle to the original pending request
562 * @param expiration when does 'data' expire? 562 * @param expiration when does 'data' expire?
563 * @param type type of the block
563 * @param data response data, NULL on request expiration 564 * @param data response data, NULL on request expiration
564 * @param data_len number of bytes in data 565 * @param data_len number of bytes in data
565 */ 566 */
@@ -567,6 +568,7 @@ static void
567handle_p2p_reply (void *cls, 568handle_p2p_reply (void *cls,
568 struct GSF_PendingRequest *pr, 569 struct GSF_PendingRequest *pr,
569 struct GNUNET_TIME_Absolute expiration, 570 struct GNUNET_TIME_Absolute expiration,
571 enum GNUNET_BLOCK_Type type,
570 const void *data, 572 const void *data,
571 size_t data_len) 573 size_t data_len)
572{ 574{
@@ -588,6 +590,13 @@ handle_p2p_reply (void *cls,
588 pr)); 590 pr));
589 return; 591 return;
590 } 592 }
593 GNUNET_break (type != GNUNET_BLOCK_TYPE_ANY);
594 if ( (prd->type != type) &&
595 (prd->type != GNUNET_BLOCK_TYPE_ANY) )
596 {
597 GNUNET_break (0);
598 return;
599 }
591#if DEBUG_FS 600#if DEBUG_FS
592 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 601 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
593 "Transmitting result for query `%s'\n", 602 "Transmitting result for query `%s'\n",
@@ -606,7 +615,7 @@ handle_p2p_reply (void *cls,
606 pm = GNUNET_malloc (sizeof (msize)); 615 pm = GNUNET_malloc (sizeof (msize));
607 pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT); 616 pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
608 pm->header.size = htons (msize); 617 pm->header.size = htons (msize);
609 pm->type = htonl (prd->type); 618 pm->type = htonl (type);
610 pm->expiration = GNUNET_TIME_absolute_hton (expiration); 619 pm->expiration = GNUNET_TIME_absolute_hton (expiration);
611 memcpy (&pm[1], data, data_len); 620 memcpy (&pm[1], data, data_len);
612 (void) GSF_peer_transmit_ (cp, GNUNET_NO, 621 (void) GSF_peer_transmit_ (cp, GNUNET_NO,
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c
index 5ceb7c2a5..3908b8a55 100644
--- a/src/fs/gnunet-service-fs_lc.c
+++ b/src/fs/gnunet-service-fs_lc.c
@@ -189,7 +189,8 @@ GSF_local_client_lookup_ (struct GNUNET_SERVER_Client *client)
189 * 189 *
190 * @param cls user-specified closure 190 * @param cls user-specified closure
191 * @param pr handle to the original pending request 191 * @param pr handle to the original pending request
192 * @param expiration when does 'data' expire? 192 * @param expiration when does 'data' expire?
193 * @param type type of the block
193 * @param data response data, NULL on request expiration 194 * @param data response data, NULL on request expiration
194 * @param data_len number of bytes in data 195 * @param data_len number of bytes in data
195 */ 196 */
@@ -197,6 +198,7 @@ static void
197client_response_handler (void *cls, 198client_response_handler (void *cls,
198 struct GSF_PendingRequest *pr, 199 struct GSF_PendingRequest *pr,
199 struct GNUNET_TIME_Absolute expiration, 200 struct GNUNET_TIME_Absolute expiration,
201 enum GNUNET_BLOCK_Type type,
200 const void *data, 202 const void *data,
201 size_t data_len) 203 size_t data_len)
202{ 204{
@@ -212,18 +214,25 @@ client_response_handler (void *cls,
212 GNUNET_break (0); 214 GNUNET_break (0);
213 return; 215 return;
214 } 216 }
217 prd = GSF_pending_request_get_data_ (pr);
218 GNUNET_break (type != GNUNET_BLOCK_TYPE_ANY);
219 if ( (prd->type != type) &&
220 (prd->type != GNUNET_BLOCK_TYPE_ANY) )
221 {
222 GNUNET_break (0);
223 return;
224 }
215 GNUNET_STATISTICS_update (GSF_stats, 225 GNUNET_STATISTICS_update (GSF_stats,
216 gettext_noop ("# replies received for local clients"), 226 gettext_noop ("# replies received for local clients"),
217 1, 227 1,
218 GNUNET_NO); 228 GNUNET_NO);
219 prd = GSF_pending_request_get_data_ (pr);
220 GNUNET_assert (pr == cr->pr); 229 GNUNET_assert (pr == cr->pr);
221 lc = cr->lc; 230 lc = cr->lc;
222 msize = sizeof (struct PutMessage) + data_len; 231 msize = sizeof (struct PutMessage) + data_len;
223 pm = GNUNET_malloc (msize); 232 pm = GNUNET_malloc (msize);
224 pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT); 233 pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
225 pm->header.size = htons (msize); 234 pm->header.size = htons (msize);
226 pm->type = htonl (prd->type); 235 pm->type = htonl (type);
227 pm->expiration = GNUNET_TIME_absolute_hton (expiration); 236 pm->expiration = GNUNET_TIME_absolute_hton (expiration);
228 memcpy (&pm[1], data, data_len); 237 memcpy (&pm[1], data, data_len);
229 GSF_local_client_transmit_ (lc, &pm->header); 238 GSF_local_client_transmit_ (lc, &pm->header);
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index 13de31c7c..8a14c4c00 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -333,6 +333,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
333 dpr->rh (dpr->rh_cls, 333 dpr->rh (dpr->rh_cls,
334 dpr, 334 dpr,
335 GNUNET_TIME_UNIT_FOREVER_ABS, 335 GNUNET_TIME_UNIT_FOREVER_ABS,
336 GNUNET_BLOCK_TYPE_ANY,
336 NULL, 0); 337 NULL, 0);
337 GSF_pending_request_cancel_ (dpr); 338 GSF_pending_request_cancel_ (dpr);
338 } 339 }
@@ -692,6 +693,7 @@ process_reply (void *cls,
692 pr->rh (pr->rh_cls, 693 pr->rh (pr->rh_cls,
693 pr, 694 pr,
694 prq->expiration, 695 prq->expiration,
696 prq->type,
695 prq->data, prq->size); 697 prq->data, prq->size);
696 return GNUNET_YES; 698 return GNUNET_YES;
697 case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE: 699 case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
@@ -749,6 +751,7 @@ process_reply (void *cls,
749 pr->rh (pr->rh_cls, 751 pr->rh (pr->rh_cls,
750 pr, 752 pr,
751 prq->expiration, 753 prq->expiration,
754 prq->type,
752 prq->data, prq->size); 755 prq->data, prq->size);
753 return GNUNET_YES; 756 return GNUNET_YES;
754} 757}
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h
index ea464e578..b546fc1ab 100644
--- a/src/fs/gnunet-service-fs_pr.h
+++ b/src/fs/gnunet-service-fs_pr.h
@@ -160,12 +160,14 @@ struct GSF_PendingRequestData
160 * @param cls user-specified closure 160 * @param cls user-specified closure
161 * @param pr handle to the original pending request 161 * @param pr handle to the original pending request
162 * @param expiration when does 'data' expire? 162 * @param expiration when does 'data' expire?
163 * @param type type of the block
163 * @param data response data, NULL on request expiration 164 * @param data response data, NULL on request expiration
164 * @param data_len number of bytes in data 165 * @param data_len number of bytes in data
165 */ 166 */
166typedef void (*GSF_PendingRequestReplyHandler)(void *cls, 167typedef void (*GSF_PendingRequestReplyHandler)(void *cls,
167 struct GSF_PendingRequest *pr, 168 struct GSF_PendingRequest *pr,
168 struct GNUNET_TIME_Absolute expiration, 169 struct GNUNET_TIME_Absolute expiration,
170 enum GNUNET_BLOCK_Type type,
169 const void *data, 171 const void *data,
170 size_t data_len); 172 size_t data_len);
171 173