mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-04 07:27:26 +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;
|
return local_type == endpoint_type_bind ? local : remote;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool clash () const { return local == remote; }
|
||||||
|
|
||||||
std::string local, remote;
|
std::string local, remote;
|
||||||
endpoint_type_t local_type;
|
endpoint_type_t local_type;
|
||||||
};
|
};
|
||||||
|
@ -294,8 +294,14 @@ bool zmq::stream_engine_base_t::in_event_internal ()
|
|||||||
// or the session has rejected the message.
|
// or the session has rejected the message.
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
if (errno != EAGAIN) {
|
if (errno != EAGAIN) {
|
||||||
error (protocol_error);
|
// In cases where the src/dst have the same IP and the dst uses an ephemeral port, reconnection
|
||||||
return false;
|
// 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;
|
_input_stopped = true;
|
||||||
reset_pollin (_handle);
|
reset_pollin (_handle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user