diff options
| author | Martin Sustrik <sustrik@fastmq.commkdir> | 2009-11-21 21:30:09 +0100 | 
|---|---|---|
| committer | Martin Sustrik <sustrik@fastmq.commkdir> | 2009-11-21 21:30:09 +0100 | 
| commit | c41daca3da6ffd033f93c3e24898414567f71eb3 (patch) | |
| tree | e0e5136ba34570d1bd8c9e299aef6bd1de762837 /src/socket_base.cpp | |
| parent | 64634605b3ccb90d582cfdf380535c89bf900a0e (diff) | |
race condition in inproc transport shutdown fixed
Diffstat (limited to 'src/socket_base.cpp')
| -rw-r--r-- | src/socket_base.cpp | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/src/socket_base.cpp b/src/socket_base.cpp index e242e05..a614759 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -158,10 +158,10 @@ int zmq::socket_base_t::connect (const char *addr_)              out_pipe ? &out_pipe->writer : NULL);          //  Attach the pipes to the peer socket. Note that peer's seqnum -        //  was incremented in find_endpoint function. When this command -        //  is delivered, peer will consider the seqnum to be processed. +        //  was incremented in find_endpoint function. The callee is notified +        //  about the fact via the last parameter.          send_bind (peer, out_pipe ? &out_pipe->reader : NULL, -            in_pipe ? &in_pipe->writer : NULL); +            in_pipe ? &in_pipe->writer : NULL, true);          return 0;      } @@ -509,8 +509,16 @@ void zmq::socket_base_t::process_own (owned_t *object_)      io_objects.insert (object_);  } -void zmq::socket_base_t::process_bind (reader_t *in_pipe_, writer_t *out_pipe_) +void zmq::socket_base_t::process_bind (reader_t *in_pipe_, writer_t *out_pipe_, +     bool adjust_seqnum_)  { +    //  In case of inproc transport, the seqnum should catch up here. +    //  For other transports the seqnum modification can be optimised out +    //  because final handshaking between the socket and the session ensures +    //  that no 'bind' command will be left unprocessed. +    if (adjust_seqnum_) +        processed_seqnum++; +      attach_pipes (in_pipe_, out_pipe_);  } | 
