Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: ZMTP 3.1 ping/pong context not implemented #3061

Closed
bluca opened this issue Apr 28, 2018 · 2 comments
Closed

Problem: ZMTP 3.1 ping/pong context not implemented #3061

bluca opened this issue Apr 28, 2018 · 2 comments

Comments

@bluca
Copy link
Member

bluca commented Apr 28, 2018

ZMTP 3.1 adds PING/PONG commands as heartbeat options that libzmq implements. The PING commands can add a context following the TTL (an arbitrary payload) which the PONG is supposed to echo back, but libzmq does not implement this.

To invoke a single heartbeat, the peer MAY, at any point after the security handshake is complete, send a PING command:

ping = command-size %d4 "PING" ping-ttl ping-context
ping-ttl = 2OCTET
ping-context = *OCTET

The ping-ttl is a 16-bit unsigned integer in network order that MAY be zero or MAY contain a time-to-live measured in tenths of seconds. The ping-ttl provides a strong hint to the other peer to disconnect if no further traffic is received after that time. The maximum TTL is 6553 seconds.

When a peer receives a PING command it SHALL respond with a PONG command that echoes the ping-context, which may be empty:

pong = command-size %d4 "PONG" ping-context
ping-context = *OCTET

https://rfc.zeromq.org/spec:37/ZMTP

@eponsko
Copy link
Contributor

eponsko commented May 9, 2018

What's the purpose of echoing the TTL back? One thing I thought could be neat is to use it to provide an estimate of the latency between the peers, to use as a weight in or alternative to the RR behavior.

@bluca
Copy link
Member Author

bluca commented May 9, 2018

It's not the TTL that's echoed back, it's an arbitrary content. I'm working on that, but I'll probably change the RFC to limit it - at the moment there's no size limit which might open it to abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants