[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35957 - gnunet/src/rps
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35957 - gnunet/src/rps |
Date: |
Sat, 20 Jun 2015 15:48:19 +0200 |
Author: ch3
Date: 2015-06-20 15:48:19 +0200 (Sat, 20 Jun 2015)
New Revision: 35957
Modified:
gnunet/src/rps/gnunet-service-rps.c
Log:
-restructured cleaning of known peers
Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2015-06-20 13:48:15 UTC (rev 35956)
+++ gnunet/src/rps/gnunet-service-rps.c 2015-06-20 13:48:19 UTC (rev 35957)
@@ -923,8 +923,6 @@
{
if (GNUNET_NO == in_arr (pull_list, pull_list_size, peer))
GNUNET_array_append (pull_list, pull_list_size, *peer);
-
- peer_clean (peer);
}
/**
@@ -2350,29 +2348,6 @@
/**
- * Clean the send channel of a peer
- */
-void
-peer_clean (const struct GNUNET_PeerIdentity *peer)
-{
- struct PeerContext *peer_ctx;
- struct GNUNET_CADET_Channel *channel;
-
- if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_contains (view, peer) &&
- GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
- {
- peer_ctx = get_peer_ctx (peer_map, peer);
- if (NULL != peer_ctx->send_channel)
- {
- channel = peer_ctx->send_channel;
- peer_ctx->send_channel = NULL;
- GNUNET_CADET_channel_destroy (channel);
- }
- }
-}
-
-
-/**
* Callback used to remove peers from the multipeermap.
*/
int
@@ -2454,6 +2429,32 @@
/**
+ * Clean the send channel of a peer
+ * If there is also no channel to receive messages from that peer, remove it
+ * from the peermap.
+ */
+void
+peer_clean (const struct GNUNET_PeerIdentity *peer)
+{
+ struct PeerContext *peer_ctx;
+ /* struct GNUNET_CADET_Channel *channel; */
+
+ if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_contains (view, peer) &&
+ GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
+ {
+ peer_ctx = get_peer_ctx (peer_map, peer);
+ GNUNET_CADET_channel_destroy (peer_ctx->send_channel);
+ peer_ctx->send_channel = NULL;
+
+ if (NULL == peer_ctx->recv_channel)
+ {
+ peer_remove_cb (NULL, peer, peer_ctx);
+ }
+ }
+}
+
+
+/**
* Task run during shutdown.
*
* @param cls unused
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35957 - gnunet/src/rps,
gnunet <=