[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35872 - gnunet/src/rps
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35872 - gnunet/src/rps |
Date: |
Sat, 6 Jun 2015 01:03:10 +0200 |
Author: ch3
Date: 2015-06-06 01:03:10 +0200 (Sat, 06 Jun 2015)
New Revision: 35872
Modified:
gnunet/src/rps/gnunet-service-rps.c
Log:
-tried to fix channel cleanups
Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2015-06-05 23:03:08 UTC (rev 35871)
+++ gnunet/src/rps/gnunet-service-rps.c 2015-06-05 23:03:10 UTC (rev 35872)
@@ -97,7 +97,14 @@
/**
* We set this bit when we can be sure the other peer is/was live.
*/
- VALID = 0x10
+ VALID = 0x10,
+
+ /**
+ * We set this bit when we are going to destroy the channel to this peer.
+ * When cleanup_channel is called, we know that we wanted to destroy it.
+ * Otherwise the channel to the other peer was destroyed.
+ */
+ TO_DESTROY = 0x20,
};
@@ -2278,6 +2285,7 @@
if (NULL != send
&& channel != send)
{
+ set_peer_flag (peer_ctx, TO_DESTROY);
GNUNET_CADET_channel_destroy (send);
}
else
@@ -2433,14 +2441,23 @@
if (NULL == peer_ctx) /* It could have been removed by shutdown_task */
return;
+
if (channel == peer_ctx->send_channel)
- { /* Peer went down or we killd the channel */
+ { /* Something (but us) killd the channel */
LOG (GNUNET_ERROR_TYPE_DEBUG,
"send channel (%s) was destroyed - cleaning up\n",
GNUNET_i2s (peer));
- rem_from_list (&gossip_list, &gossip_list_size, peer);
- rem_from_list (&pending_pull_reply_list, &pending_pull_reply_list_size,
peer);
+ rem_from_list (&gossip_list,
+ &gossip_list_size,
+ peer);
+ rem_from_list (&pending_pull_reply_list,
+ &pending_pull_reply_list_size,
+ peer);
+ to_file (file_name_view_log,
+ "-%s\t(cleanup channel, other peer)",
+ GNUNET_i2s_full (peer));
+
peer_ctx->send_channel = NULL;
/* Somwewhat {ab,re}use the iterator function */
/* Cast to void is ok, because it's used as void in peer_remove_cb */
@@ -2458,6 +2475,33 @@
GNUNET_i2s (peer));
peer_ctx->recv_channel = NULL;
}
+ else if (NULL == peer_ctx->send_channel &&
+ get_peer_flag (peer_ctx, TO_DESTROY))
+ { /* We closed the channel to that peer */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "send channel (%s) was destroyed by us - cleaning up\n",
+ GNUNET_i2s (peer));
+
+ rem_from_list (&gossip_list,
+ &gossip_list_size,
+ peer);
+ rem_from_list (&pending_pull_reply_list,
+ &pending_pull_reply_list_size,
+ peer);
+ to_file (file_name_view_log,
+ "-%s\t(cleanup channel, ourself)",
+ GNUNET_i2s_full (peer));
+
+ /* Somwewhat {ab,re}use the iterator function */
+ /* Cast to void is ok, because it's used as void in peer_remove_cb */
+ (void) peer_remove_cb ((void *) channel, peer, peer_ctx);
+ }
+ else
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "unknown channel (%s) was destroyed\n",
+ GNUNET_i2s (peer));
+ }
//}
}
@@ -2569,8 +2613,8 @@
size,
out_size);
}
-
+
/* connect to NSE */
nse = GNUNET_NSE_connect (cfg, nse_callback, NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35872 - gnunet/src/rps,
gnunet <=