Commit 23f3f48b authored by louiz’'s avatar louiz’

Only consider sockets that are in valid states as identd candidates

When an identd query happens, we check all the connected sockets for their
local and remote ports, to compare them with the query.  But we MUST only
consider the connected ones because:

- It doesn’t make sense to answer for a connection that has just been closed
- A non-connected sockets is not in a valid state for this (specifically
  here: its ::port attribute is empty)

fix #3421
parent b18d81ae
......@@ -263,6 +263,8 @@ std::string TCPClientSocketHandler::get_port() const
bool TCPClientSocketHandler::match_port_pair(const uint16_t local, const uint16_t remote) const
{
if (!this->is_connected())
return false;
const auto remote_port = static_cast<uint16_t>(std::stoi(this->port));
return this->is_connected() && local == this->local_port && remote == remote_port;
return local == this->local_port && remote == remote_port;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment