Updated libzmq to match RFC 23, 24, 25, 26

* Command names changed from null terminated to length-specified
* Command frames use the correct flag (bit 2)
* test_stream acts as test case for command frames
* Some code cleanups
This commit is contained in:
Pieter Hintjens
2013-09-04 17:59:45 +02:00
parent 1844a27c82
commit 28b0a5fa27
18 changed files with 114 additions and 107 deletions

View File

@@ -53,7 +53,7 @@ zmq::null_mechanism_t::~null_mechanism_t ()
{
}
int zmq::null_mechanism_t::next_handshake_message (msg_t *msg_)
int zmq::null_mechanism_t::next_handshake_command (msg_t *msg_)
{
if (ready_command_sent) {
errno = EAGAIN;
@@ -78,7 +78,7 @@ int zmq::null_mechanism_t::next_handshake_message (msg_t *msg_)
unsigned char *ptr = command_buffer;
// Add mechanism string
memcpy (ptr, "READY\0", 6);
memcpy (ptr, "\5READY", 6);
ptr += 6;
// Add socket type property
@@ -104,7 +104,7 @@ int zmq::null_mechanism_t::next_handshake_message (msg_t *msg_)
return 0;
}
int zmq::null_mechanism_t::process_handshake_message (msg_t *msg_)
int zmq::null_mechanism_t::process_handshake_command (msg_t *msg_)
{
if (ready_command_received) {
errno = EPROTO;
@@ -115,7 +115,7 @@ int zmq::null_mechanism_t::process_handshake_message (msg_t *msg_)
static_cast <unsigned char *> (msg_->data ());
size_t bytes_left = msg_->size ();
if (bytes_left < 6 || memcmp (ptr, "READY\0", 6)) {
if (bytes_left < 6 || memcmp (ptr, "\5READY", 6)) {
errno = EPROTO;
return -1;
}