gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r35265 - gnunet/src/rps


From: gnunet
Subject: [GNUnet-SVN] r35265 - gnunet/src/rps
Date: Sun, 15 Feb 2015 18:19:57 +0100

Author: ch3
Date: 2015-02-15 18:19:57 +0100 (Sun, 15 Feb 2015)
New Revision: 35265

Modified:
   gnunet/src/rps/gnunet-service-rps.c
Log:
- don't add own id to pull_list

Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2015-02-15 17:19:54 UTC (rev 35264)
+++ gnunet/src/rps/gnunet-service-rps.c 2015-02-15 17:19:57 UTC (rev 35265)
@@ -1197,21 +1197,26 @@
   struct PeerOutstandingOp out_op;
   uint32_t i;
 
+  /* Check for protocol violation */
   if (sizeof (struct GNUNET_RPS_P2P_PullReplyMessage) > ntohs (msg->size))
   {
-    GNUNET_break_op (0); // At the moment our own implementation seems to 
break that.
+    GNUNET_break_op (0);
     return GNUNET_SYSERR;
   }
   in_msg = (struct GNUNET_RPS_P2P_PullReplyMessage *) msg;
-  if ((ntohs (msg->size) - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) / 
sizeof (struct GNUNET_PeerIdentity) != ntohl (in_msg->num_peers))
+  if ((ntohs (msg->size) - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) /
+      sizeof (struct GNUNET_PeerIdentity) != ntohl (in_msg->num_peers))
   {
-    LOG (GNUNET_ERROR_TYPE_ERROR, "message says it sends %" PRIu64 " peers, 
have space for %i peers\n",
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+        "message says it sends %" PRIu64 " peers, have space for %i peers\n",
         ntohl (in_msg->num_peers),
-        (ntohs (msg->size) - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) 
/ sizeof (struct GNUNET_PeerIdentity));
+        (ntohs (msg->size) - sizeof (struct GNUNET_RPS_P2P_PullReplyMessage)) /
+            sizeof (struct GNUNET_PeerIdentity));
     GNUNET_break_op (0);
     return GNUNET_SYSERR;
   }
 
+  /* Do actual logic */
   sender = (struct GNUNET_PeerIdentity *) GNUNET_CADET_channel_get_info (
       (struct GNUNET_CADET_Channel *) channel, GNUNET_CADET_OPTION_PEER);
        // Guess simply casting isn't the nicest way...
@@ -1231,7 +1236,8 @@
     if (NULL != peer_ctx->send_channel
         || NULL != peer_ctx->recv_channel)
     {
-      if (GNUNET_NO == in_arr (pull_list, pull_list_size, &peers[i]))
+      if (GNUNET_NO == in_arr (pull_list, pull_list_size, &peers[i])
+          && GNUNET_CRYPTO_cmp_peer_identity (&own_identity, &peers[i]))
         GNUNET_array_append (pull_list, pull_list_size, peers[i]);
     }
     else if (GNUNET_NO == insert_in_pull_list_scheduled (peer_ctx))




reply via email to

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