Problem: libzmq does not send ZMTP 3.1 sub/cancel commands

Solution: if all peers of a socket are >= 3.1 use sub/cancel commands
instead of the old 0/1 messages.
For backward compatibility, move the handling of 0/1 or sub/cancel
command strings to the encoders, so that the right thing can be done
depending on the protocol version.
Do not set the command flag until the encoder, so that we can handle
the inproc case (which skips the encoder).
This commit is contained in:
Luca Boccassi
2018-05-28 19:59:44 +01:00
parent e7f802d1ac
commit 253e9dd27b
16 changed files with 432 additions and 128 deletions

View File

@@ -49,7 +49,8 @@ namespace zmq
enum
{
ZMTP_1_0 = 0,
ZMTP_2_0 = 1
ZMTP_2_0 = 1,
ZMTP_3_x = 3
};
class io_thread_t;
@@ -85,12 +86,15 @@ class zmtp_engine_t ZMQ_FINAL : public stream_engine_base_t
typedef bool (zmtp_engine_t::*handshake_fun_t) ();
static handshake_fun_t select_handshake_fun (bool unversioned,
unsigned char revision);
unsigned char revision,
unsigned char minor);
bool handshake_v1_0_unversioned ();
bool handshake_v1_0 ();
bool handshake_v2_0 ();
bool handshake_v3_x ();
bool handshake_v3_0 ();
bool handshake_v3_1 ();
int routing_id_msg (msg_t *msg_);
int process_routing_id_msg (msg_t *msg_);