mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-28 19:52:00 +01:00
Fixed ZMQ_REQ_CORRELATE (see pull request #1730)
Problem: Since pull request #1730 was merged, protocol for REQ socket is checked at the session level and this check does not take into account the possibility of a request_id being part of the message. Thus the option ZMQ_REQ_CORRELATE would no longer work. This is now fixed: the possiblity of a 4 bytes integer being present before the delimiter frame is taken into account (whether or not this breaks the REQ/REP RFC is another issue).
This commit is contained in:
15
src/req.cpp
15
src/req.cpp
@@ -279,6 +279,21 @@ int zmq::req_session_t::push_msg (msg_t *msg_)
|
||||
{
|
||||
switch (state) {
|
||||
case bottom:
|
||||
if (msg_->flags () == msg_t::more) {
|
||||
// In case option ZMQ_CORRELATE is on, allow request_id to be
|
||||
// transfered as first frame (would be too cumbersome to check
|
||||
// whether the option is actually on or not).
|
||||
if (msg_->size () == sizeof (uint32_t)) {
|
||||
state = request_id;
|
||||
return session_base_t::push_msg (msg_);
|
||||
}
|
||||
else if (msg_->size () == 0) {
|
||||
state = body;
|
||||
return session_base_t::push_msg (msg_);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case request_id:
|
||||
if (msg_->flags () == msg_t::more && msg_->size () == 0) {
|
||||
state = body;
|
||||
return session_base_t::push_msg (msg_);
|
||||
|
||||
Reference in New Issue
Block a user