gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14722 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r14722 - gnunet/src/fs
Date: Fri, 25 Mar 2011 12:02:34 +0100

Author: grothoff
Date: 2011-03-25 12:02:34 +0100 (Fri, 25 Mar 2011)
New Revision: 14722

Modified:
   gnunet/src/fs/gnunet-service-fs_cp.c
   gnunet/src/fs/gnunet-service-fs_lc.c
   gnunet/src/fs/gnunet-service-fs_pr.c
   gnunet/src/fs/gnunet-service-fs_pr.h
Log:
fix

Modified: gnunet/src/fs/gnunet-service-fs_cp.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_cp.c        2011-03-25 10:53:50 UTC (rev 
14721)
+++ gnunet/src/fs/gnunet-service-fs_cp.c        2011-03-25 11:02:34 UTC (rev 
14722)
@@ -560,6 +560,7 @@
  *            have liked an answer to the request
  * @param pr handle to the original pending request
  * @param expiration when does 'data' expire?
+ * @param type type of the block
  * @param data response data, NULL on request expiration
  * @param data_len number of bytes in data
  */
@@ -567,6 +568,7 @@
 handle_p2p_reply (void *cls,
                  struct GSF_PendingRequest *pr,
                  struct GNUNET_TIME_Absolute expiration,
+                 enum GNUNET_BLOCK_Type type,
                  const void *data,
                  size_t data_len)
 {
@@ -588,6 +590,13 @@
                                                          pr));
       return;
     }  
+  GNUNET_break (type != GNUNET_BLOCK_TYPE_ANY);
+  if ( (prd->type != type) &&
+       (prd->type != GNUNET_BLOCK_TYPE_ANY) )
+    {
+      GNUNET_break (0);
+      return;
+    }
 #if DEBUG_FS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Transmitting result for query `%s'\n",
@@ -606,7 +615,7 @@
   pm = GNUNET_malloc (sizeof (msize));
   pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
   pm->header.size = htons (msize);
-  pm->type = htonl (prd->type);
+  pm->type = htonl (type);
   pm->expiration = GNUNET_TIME_absolute_hton (expiration);
   memcpy (&pm[1], data, data_len);
   (void) GSF_peer_transmit_ (cp, GNUNET_NO,

Modified: gnunet/src/fs/gnunet-service-fs_lc.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_lc.c        2011-03-25 10:53:50 UTC (rev 
14721)
+++ gnunet/src/fs/gnunet-service-fs_lc.c        2011-03-25 11:02:34 UTC (rev 
14722)
@@ -189,7 +189,8 @@
  *
  * @param cls user-specified closure
  * @param pr handle to the original pending request
- * @param expiration when does 'data' expire?
+ * @param expiration when does 'data' expire? 
+ * @param type type of the block
  * @param data response data, NULL on request expiration
  * @param data_len number of bytes in data
  */
@@ -197,6 +198,7 @@
 client_response_handler (void *cls,
                         struct GSF_PendingRequest *pr,
                         struct GNUNET_TIME_Absolute expiration,
+                        enum GNUNET_BLOCK_Type type,
                         const void *data,
                         size_t data_len)
 {
@@ -212,18 +214,25 @@
       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);
-  prd = GSF_pending_request_get_data_ (pr);
   GNUNET_assert (pr == cr->pr);
   lc = cr->lc;
   msize = sizeof (struct PutMessage) + data_len;
   pm = GNUNET_malloc (msize);
   pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
   pm->header.size = htons (msize);
-  pm->type = htonl (prd->type);
+  pm->type = htonl (type);
   pm->expiration = GNUNET_TIME_absolute_hton (expiration);
   memcpy (&pm[1], data, data_len);      
   GSF_local_client_transmit_ (lc, &pm->header);

Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c        2011-03-25 10:53:50 UTC (rev 
14721)
+++ gnunet/src/fs/gnunet-service-fs_pr.c        2011-03-25 11:02:34 UTC (rev 
14722)
@@ -333,6 +333,7 @@
          dpr->rh (dpr->rh_cls,
                   dpr,
                   GNUNET_TIME_UNIT_FOREVER_ABS,
+                  GNUNET_BLOCK_TYPE_ANY,
                   NULL, 0);
          GSF_pending_request_cancel_ (dpr);
        }
@@ -692,6 +693,7 @@
       pr->rh (pr->rh_cls,            
              pr,
              prq->expiration,
+             prq->type,
              prq->data, prq->size);
       return GNUNET_YES;
     case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
@@ -749,6 +751,7 @@
   pr->rh (pr->rh_cls,
          pr, 
          prq->expiration,
+         prq->type,
          prq->data, prq->size);
   return GNUNET_YES;
 }

Modified: gnunet/src/fs/gnunet-service-fs_pr.h
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.h        2011-03-25 10:53:50 UTC (rev 
14721)
+++ gnunet/src/fs/gnunet-service-fs_pr.h        2011-03-25 11:02:34 UTC (rev 
14722)
@@ -160,12 +160,14 @@
  * @param cls user-specified closure
  * @param pr handle to the original pending request
  * @param expiration when does 'data' expire?
+ * @param type type of the block
  * @param data response data, NULL on request expiration
  * @param data_len number of bytes in data
  */
 typedef void (*GSF_PendingRequestReplyHandler)(void *cls,
                                               struct GSF_PendingRequest *pr,
                                               struct GNUNET_TIME_Absolute 
expiration,
+                                              enum GNUNET_BLOCK_Type type,
                                               const void *data,
                                               size_t data_len);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]