Revert "As Martin pointed out, there is a race condition in the old code where a pipe could start shutting down after disconnection, but the new one could connect first. This connection would not get a pipe created for it, so the messages could never flow. The simplest way round this would be a flag, but it is possibly for a very bouncy but fast connection to go up and down twice I imagine, so instead I have added a counter. This starts at zero, and will null out the pipe if terminate is called while it is zero. On a disconnect situation the counter is incremented, and the pipe is the not nulled if the value is non zero. In the terminated function it is decremented for each pipe that is shut down, and the assertion that the terminated pipe == the current pipe is skipped while it is non-zero. This should deal with the race condition and not allow any extra terminated() calls without hitting the assertion."

This reverts commit a5f7300da6.
This commit is contained in:
Ian Barber
2012-06-12 14:45:14 +01:00
parent 19da88be67
commit c9926f6f24
2 changed files with 4 additions and 14 deletions

View File

@@ -103,9 +103,6 @@ namespace zmq
// Pipe connecting the session to its socket.
zmq::pipe_t *pipe;
// This flag is set if we are disconnecting, but haven't yet completed
int incomplete_detach;
// This flag is true if the remainder of the message being processed
// is still in the in pipe.