Use revision_pos constant

This commit is contained in:
Simon Giesecke 2018-08-09 12:47:18 +02:00
parent 758f903db4
commit 3cb77e423e

View File

@ -485,6 +485,9 @@ void zmq::stream_engine_t::restart_input ()
} }
} }
// Position of the revision field in the greeting.
const size_t revision_pos = 10;
bool zmq::stream_engine_t::handshake () bool zmq::stream_engine_t::handshake ()
{ {
zmq_assert (_handshaking); zmq_assert (_handshaking);
@ -495,9 +498,6 @@ bool zmq::stream_engine_t::handshake ()
return false; return false;
const bool unversioned = rc != 0; const bool unversioned = rc != 0;
// Position of the revision field in the greeting.
const size_t revision_pos = 10;
if (!(this if (!(this
->*select_handshake_fun (unversioned, ->*select_handshake_fun (unversioned,
_greeting_recv[revision_pos])) ()) _greeting_recv[revision_pos])) ())
@ -579,8 +579,8 @@ void zmq::stream_engine_t::receive_greeting_versioned ()
set_pollout (_handle); set_pollout (_handle);
// Use ZMTP/2.0 to talk to older peers. // Use ZMTP/2.0 to talk to older peers.
if (_greeting_recv[10] == ZMTP_1_0 if (_greeting_recv[revision_pos] == ZMTP_1_0
|| _greeting_recv[10] == ZMTP_2_0) || _greeting_recv[revision_pos] == ZMTP_2_0)
_outpos[_outsize++] = _options.type; _outpos[_outsize++] = _options.type;
else { else {
_outpos[_outsize++] = 0; // Minor version number _outpos[_outsize++] = 0; // Minor version number