gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r16110 - gnunet/src/fs
Date: Tue, 19 Jul 2011 13:34:34 +0200

Author: grothoff
Date: 2011-07-19 13:34:33 +0200 (Tue, 19 Jul 2011)
New Revision: 16110

Modified:
   gnunet/src/fs/gnunet-service-fs_cp.c
Log:
cleaner

Modified: gnunet/src/fs/gnunet-service-fs_cp.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_cp.c        2011-07-19 11:12:08 UTC (rev 
16109)
+++ gnunet/src/fs/gnunet-service-fs_cp.c        2011-07-19 11:34:33 UTC (rev 
16110)
@@ -1604,9 +1604,13 @@
 GSF_peer_update_responder_peer_ (struct GSF_ConnectedPeer *cp,
                                 const struct GSF_ConnectedPeer *initiator_peer)
 {
-  GNUNET_PEER_change_rc (cp->ppd.last_p2p_replies[cp->last_p2p_replies_woff % 
P2P_SUCCESS_LIST_SIZE], -1);
-  cp->ppd.last_p2p_replies[cp->last_p2p_replies_woff++ % 
P2P_SUCCESS_LIST_SIZE] = initiator_peer->ppd.pid;
+  unsigned int woff;
+
+  woff = cp->last_p2p_replies_woff % P2P_SUCCESS_LIST_SIZE;
+  GNUNET_PEER_change_rc (cp->ppd.last_p2p_replies[woff], -1);
+  cp->ppd.last_p2p_replies[woff] = initiator_peer->ppd.pid;
   GNUNET_PEER_change_rc (initiator_peer->ppd.pid, 1);
+  cp->last_p2p_replies_woff = (woff + 1) % P2P_SUCCESS_LIST_SIZE;
 }
 
 
@@ -1685,6 +1689,7 @@
   GSF_plan_notify_peer_disconnect_ (cp);
   GNUNET_LOAD_value_free (cp->ppd.transmission_delay);
   GNUNET_PEER_decrement_rcs (cp->ppd.last_p2p_replies, P2P_SUCCESS_LIST_SIZE);
+  memset (cp->ppd.last_p2p_replies, 0, sizeof (cp->ppd.last_p2p_replies));
   GSF_push_stop_ (cp);
   while (NULL != (pth = cp->pth_head))
     {




reply via email to

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