gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r36142 - gnunet/src/rps
Date: Wed, 29 Jul 2015 14:26:15 +0200

Author: ch3
Date: 2015-07-29 14:26:14 +0200 (Wed, 29 Jul 2015)
New Revision: 36142

Modified:
   gnunet/src/rps/gnunet-service-rps.c
Log:
-fixes and improvements

Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2015-07-29 11:28:17 UTC (rev 36141)
+++ gnunet/src/rps/gnunet-service-rps.c 2015-07-29 12:26:14 UTC (rev 36142)
@@ -1962,7 +1962,7 @@
           &attacked_peer))
     {
       att_ctx = create_peer_ctx (&attacked_peer);
-      set_peer_flag (att_ctx, VALID);
+      check_peer_live (att_ctx);
     }
 
     LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -2053,7 +2053,7 @@
      * That is one push per round as it will ignore more.
      */
     peer_ctx = get_peer_ctx (&attacked_peer);
-    if (NULL == peer_ctx->transmit_handle)
+    if (GNUNET_YES == get_peer_flag (peer_ctx, VALID))
       send_push (&attacked_peer);
   }
 
@@ -2317,7 +2317,7 @@
          GNUNET_i2s (&push_list[i]));
     RPS_sampler_update (prot_sampler,   &push_list[i]);
     RPS_sampler_update (client_sampler, &push_list[i]);
-    // TODO set in_flag?
+    peer_clean (&push_list[i]); /* This cleans only if it is not in the view */
   }
 
   for (i = 0; i < pull_list_size; i++)
@@ -2327,7 +2327,7 @@
          GNUNET_i2s (&pull_list[i]));
     RPS_sampler_update (prot_sampler,   &pull_list[i]);
     RPS_sampler_update (client_sampler, &pull_list[i]);
-    // TODO set in_flag?
+    peer_clean (&pull_list[i]); /* This cleans only if it is not in the view */
   }
 
 
@@ -2411,7 +2411,7 @@
   set_peer_flag (peer_ctx, TO_DESTROY);
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Going to clean peer %s\n",
+       "Going to remove peer %s\n",
        GNUNET_i2s (&peer_ctx->peer_id));
 
   /* If operations are still scheduled for this peer cancel those */
@@ -2435,10 +2435,19 @@
 
   unset_peer_flag (peer_ctx, PULL_REPLY_PENDING);
 
-  to_file (file_name_view_log,
-           "-%s\t(cleanup channel, other peer)",
-           GNUNET_i2s_full (key));
-  GNUNET_CONTAINER_multipeermap_remove_all (view, key);
+  /* Remove peer from view */
+  if (GNUNET_CONTAINER_multipeermap_contains (view, key))
+  {
+    to_file (file_name_view_log,
+        "-%s\t(cleanup channel, other peer)",
+        GNUNET_i2s_full (key));
+    GNUNET_CONTAINER_multipeermap_remove_all (view, key);
+    if (NULL != view_array)
+    {
+      GNUNET_free (view_array);
+      view_array = NULL;
+    }
+  }
 
   /* If there is still a mq destroy it */
   if (NULL != peer_ctx->mq)
@@ -2489,8 +2498,10 @@
   struct PeerContext *peer_ctx;
   /* struct GNUNET_CADET_Channel *channel; */
 
-  if (GNUNET_NO  == GNUNET_CONTAINER_multipeermap_contains (view, peer) &&
-      GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
+  if ( (GNUNET_NO  == GNUNET_CONTAINER_multipeermap_contains (view, peer)) &&
+       (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) 
&&
+       (GNUNET_NO  == in_arr (push_list, push_list_size, peer)) &&
+       (GNUNET_NO  == in_arr (pull_list, pull_list_size, peer)) )
   {
     peer_ctx = get_peer_ctx (peer);
 




reply via email to

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