Skip to content

Commit f42a44c

Browse files
authored
Merge pull request #753 from stvales/start-stop
Problem: Rapid zyre start/stop may create a hello/goodbye storm between peers
2 parents e25cf6f + 27771ed commit f42a44c

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/zyre_node.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,10 +1082,18 @@ zyre_node_recv_peer (zyre_node_t *self)
10821082
zyre_peer_t *peer = (zyre_peer_t *) zhash_lookup (self->peers, zuuid_str (uuid));
10831083
if (zre_msg_id (msg) == ZRE_MSG_HELLO) {
10841084
if (peer) {
1085-
// Remove fake peers
1085+
// ignore already existing peers
10861086
if (zyre_peer_ready (peer)) {
1087-
zyre_node_remove_peer (self, peer);
1088-
assert (!(zyre_peer_t *) zhash_lookup (self->peers, zuuid_str (uuid)));
1087+
/*
1088+
NB: we ignore peer here instead of destroying due to possible erroneous
1089+
destruction in case of rapid deconnection/reconnection of our node, (e.g.,
1090+
when wrongly using zyre_start/zyre_stop), in which case the ZRE_MSG_HELLO
1091+
may be received twice from other peers and subsequent peers removal would
1092+
provoke a HELLO/GOODBYE storm with the erroneously destroyed peers.
1093+
In the case of a peer reconnecting with the same endpoint and the previous
1094+
one being non-responsive, ping mechanism will take care of cleaning it.
1095+
*/
1096+
return;
10891097
}
10901098
else
10911099
if (streq (zyre_peer_endpoint (peer), self->endpoint)) {

0 commit comments

Comments
 (0)