[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34747 - gnunet/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34747 - gnunet/src/fs |
Date: |
Sun, 21 Dec 2014 02:26:46 +0100 |
Author: otarabai
Date: 2014-12-21 02:26:46 +0100 (Sun, 21 Dec 2014)
New Revision: 34747
Modified:
gnunet/src/fs/gnunet-service-fs_cp.c
Log:
flush peer respect value on disconnect
Modified: gnunet/src/fs/gnunet-service-fs_cp.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_cp.c 2014-12-20 18:30:59 UTC (rev
34746)
+++ gnunet/src/fs/gnunet-service-fs_cp.c 2014-12-21 01:26:46 UTC (rev
34747)
@@ -1515,6 +1515,32 @@
/**
+ * Write peer-respect information to a file - flush the buffer entry!
+ *
+ * @param cls unused
+ * @param key peer identity
+ * @param value the 'struct GSF_ConnectedPeer' to flush
+ * @return GNUNET_OK to continue iteration
+ */
+static int
+flush_respect (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
+{
+ struct GSF_ConnectedPeer *cp = value;
+ struct GNUNET_PeerIdentity pid;
+
+ if (cp->ppd.respect == cp->disk_respect)
+ return GNUNET_OK; /* unchanged */
+ GNUNET_assert (0 != cp->ppd.pid);
+ GNUNET_PEER_resolve (cp->ppd.pid, &pid);
+ GNUNET_PEERSTORE_store (peerstore, "fs", &pid, "respect", &cp->ppd.respect,
+ sizeof (cp->ppd.respect),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_PEERSTORE_STOREOPTION_REPLACE, NULL, NULL);
+ return GNUNET_OK;
+}
+
+
+/**
* A peer disconnected from us. Tear down the connected peer
* record.
*
@@ -1533,6 +1559,7 @@
if (NULL == cp)
return; /* must have been disconnect from core with
* 'peer' == my_id, ignore */
+ flush_respect (NULL, peer, cp);
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multipeermap_remove (cp_map,
peer,
@@ -1760,32 +1787,6 @@
/**
- * Write peer-respect information to a file - flush the buffer entry!
- *
- * @param cls unused
- * @param key peer identity
- * @param value the 'struct GSF_ConnectedPeer' to flush
- * @return GNUNET_OK to continue iteration
- */
-static int
-flush_respect (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
-{
- struct GSF_ConnectedPeer *cp = value;
- struct GNUNET_PeerIdentity pid;
-
- if (cp->ppd.respect == cp->disk_respect)
- return GNUNET_OK; /* unchanged */
- GNUNET_assert (0 != cp->ppd.pid);
- GNUNET_PEER_resolve (cp->ppd.pid, &pid);
- GNUNET_PEERSTORE_store (peerstore, "fs", &pid, "respect", &cp->ppd.respect,
- sizeof (cp->ppd.respect),
- GNUNET_TIME_UNIT_FOREVER_ABS,
- GNUNET_PEERSTORE_STOREOPTION_REPLACE, NULL, NULL);
- return GNUNET_OK;
-}
-
-
-/**
* Notify core about a preference we have for the given peer
* (to allocate more resources towards it). The change will
* be communicated the next time we reserve bandwidth with
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34747 - gnunet/src/fs,
gnunet <=