gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r13120 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r13120 - gnunet/src/dht
Date: Sat, 2 Oct 2010 15:33:21 +0200

Author: grothoff
Date: 2010-10-02 15:33:21 +0200 (Sat, 02 Oct 2010)
New Revision: 13120

Modified:
   gnunet/src/dht/dht_api_find_peer.c
Log:
new DHT API code

Modified: gnunet/src/dht/dht_api_find_peer.c
===================================================================
--- gnunet/src/dht/dht_api_find_peer.c  2010-10-02 13:30:41 UTC (rev 13119)
+++ gnunet/src/dht/dht_api_find_peer.c  2010-10-02 13:33:21 UTC (rev 13120)
@@ -25,7 +25,15 @@
  * @author Nathan Evans
  */
 
+#include "platform.h"
+#include "gnunet_constants.h"
+#include "gnunet_arm_service.h"
+#include "gnunet_protocols.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_dht_service.h"
+#include "dht.h"
 
+
 /**
  * Handle to control a find peer operation.
  */
@@ -56,32 +64,27 @@
  * operation
  */
 static void
-find_peer_reply_iterator (void *cls, const struct GNUNET_MessageHeader *reply)
+find_peer_reply_iterator (void *cls, 
+                         const GNUNET_HashCode *key,
+                         const struct GNUNET_MessageHeader *reply)
 {
   struct GNUNET_DHT_FindPeerHandle *find_peer_handle = cls;
-  struct GNUNET_MessageHeader *hello;
+  const struct GNUNET_MessageHeader *hello;
 
   if (ntohs (reply->type) != GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_RESULT)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Received wrong type of response to a find peer 
request...\n");
+      GNUNET_break (0);
       return;
     }
-
-
-  GNUNET_assert (ntohs (reply->size) >=
-                 sizeof (struct GNUNET_MessageHeader));
-  hello = (struct GNUNET_MessageHeader *)&reply[1];
-
+  GNUNET_assert (ntohs (reply->size) >= sizeof (struct GNUNET_MessageHeader));
+  hello = (const struct GNUNET_MessageHeader *)&reply[1];
   if (ntohs(hello->type) != GNUNET_MESSAGE_TYPE_HELLO)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Encapsulated message of type %d, is not a `%s' message!\n", 
ntohs(hello->type), "HELLO");
+      GNUNET_break (0);
       return;
     }
-  find_peer_handle->find_peer_context.proc (find_peer_handle->
-                                            find_peer_context.proc_cls,
-                                            (struct GNUNET_HELLO_Message 
*)hello);
+  find_peer_handle->proc (find_peer_handle->proc_cls,
+                         (const struct GNUNET_HELLO_Message *)hello);
 }
 
 
@@ -101,8 +104,8 @@
 struct GNUNET_DHT_FindPeerHandle *
 GNUNET_DHT_find_peer_start (struct GNUNET_DHT_Handle *handle,
                             struct GNUNET_TIME_Relative timeout,
+                            const GNUNET_HashCode *key,
                             enum GNUNET_DHT_RouteOption options,
-                            const GNUNET_HashCode *key,
                             GNUNET_DHT_FindPeerProcessor proc,
                             void *proc_cls)
 {




reply via email to

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