Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix. Set correct peer status on HELLO #219

Merged
merged 1 commit into from

3 participants

@moteus
Owner

Suppose we get HELLO with group CHAT and status 1.
If we set peer status and then call zyre_node_join_peer_group then
peer status become to 2.
So we should set status after we call zyre_node_join_peer_group.

@moteus moteus Fix. Set correct peer status on HELLO
Suppose we get HELLO with group `CHAT` and status `1`.
If we set peer status and then call `zyre_node_join_peer_group` then
peer status become to `2`.
So we should set status after we call `zyre_node_join_peer_group`.
4e224cc
@keent keent merged commit d3fb0ec into from
@hintjens
Owner

I don't see how zyre_node_join_peer_group() modifies the peer's status. Moving this line around makes no difference as far as I can tell. Did you have a test case?

@moteus
Owner

zyre_node_join_peer_group calls zyre_group_join which increment peer's status

@hintjens
Owner
@hintjens
Owner
@moteus
Owner

I do not think so.
Basic example.
Node can JOIN->LEAVE->... after that in network appears new node and we send HELLO.
Our status is 2 but there no groups in HELLO.
Also I do not think it is good idea to assert if we get wrong message from some client.
This is public protocol and now one nede in network can crash all nodes.
We can Immediately reconnect, delay reconnect or ban such nodes and behaviour may depend from application or described in RFC.

@hintjens
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 24, 2014
  1. @moteus

    Fix. Set correct peer status on HELLO

    moteus authored
    Suppose we get HELLO with group `CHAT` and status `1`.
    If we set peer status and then call `zyre_node_join_peer_group` then
    peer status become to `2`.
    So we should set status after we call `zyre_node_join_peer_group`.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/zyre_node.c
View
2  src/zyre_node.c
@@ -615,7 +615,6 @@ zyre_node_recv_peer (zyre_node_t *self)
if (zre_msg_id (msg) == ZRE_MSG_HELLO) {
// Store properties from HELLO command into peer
zyre_peer_set_name (peer, zre_msg_name (msg));
- zyre_peer_set_status (peer, zre_msg_status (msg));
zyre_peer_set_headers (peer, zre_msg_headers (msg));
// Tell the caller about the peer
@@ -636,6 +635,7 @@ zyre_node_recv_peer (zyre_node_t *self)
zyre_node_join_peer_group (self, peer, name);
name = zre_msg_groups_next (msg);
}
+ zyre_peer_set_status (peer, zre_msg_status (msg));
}
else
if (zre_msg_id (msg) == ZRE_MSG_WHISPER) {
Something went wrong with that request. Please try again.