mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 10:33:52 +01:00
Handle tcp self connection issues (#4599)
This commit is contained in:
parent
dbb7e3dc01
commit
9d31965548
@ -29,6 +29,8 @@ struct endpoint_uri_pair_t
|
||||
return local_type == endpoint_type_bind ? local : remote;
|
||||
}
|
||||
|
||||
const bool clash () const { return local == remote; }
|
||||
|
||||
std::string local, remote;
|
||||
endpoint_type_t local_type;
|
||||
};
|
||||
|
@ -294,9 +294,15 @@ bool zmq::stream_engine_base_t::in_event_internal ()
|
||||
// or the session has rejected the message.
|
||||
if (rc == -1) {
|
||||
if (errno != EAGAIN) {
|
||||
// In cases where the src/dst have the same IP and the dst uses an ephemeral port, reconnection
|
||||
// eventually results in the src and dest IP and port clashing (google tcp self connection)
|
||||
// While this is a protocol_error (you have the single zmq socket handshaking with itself)
|
||||
// we do not want to to stop reconnection from happening
|
||||
if (!_endpoint_uri_pair.clash ()) {
|
||||
error (protocol_error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
_input_stopped = true;
|
||||
reset_pollin (_handle);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user