Merge branch 'v8'
This commit is contained in:
@@ -24,6 +24,7 @@ class IdentdServer: public TcpSocketServer<IdentdSocket>
|
||||
if (this->poller->is_managing_socket(this->socket))
|
||||
this->poller->remove_socket_handler(this->socket);
|
||||
::close(this->socket);
|
||||
this->sockets.clear();
|
||||
}
|
||||
void clean()
|
||||
{
|
||||
|
||||
@@ -25,10 +25,12 @@ void IdentdSocket::parse_in_buffer(const std::size_t)
|
||||
std::istringstream line(this->in_buf.substr(0, line_end));
|
||||
this->consume_in_buffer(line_end + 1);
|
||||
|
||||
uint16_t local_port;
|
||||
uint16_t remote_port;
|
||||
uint16_t local_port{};
|
||||
uint16_t remote_port{};
|
||||
char sep;
|
||||
line >> local_port >> sep >> remote_port;
|
||||
if (line.fail()) // Data did not match the expected format, ignore the line entirely
|
||||
continue;
|
||||
const auto& xmpp = this->server.get_biboumi_component();
|
||||
auto response = this->generate_answer(xmpp, local_port, remote_port);
|
||||
|
||||
@@ -47,7 +49,7 @@ std::string IdentdSocket::generate_answer(const BiboumiComponent& biboumi, uint1
|
||||
{
|
||||
for (const auto& pair: bridge->get_irc_clients())
|
||||
{
|
||||
if (pair.second->match_port_pairt(local, remote))
|
||||
if (pair.second->match_port_pair(local, remote))
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << local << " , " << remote << " : USERID : OTHER : " << hash_jid(bridge->get_bare_jid()) << "\r\n";
|
||||
|
||||
@@ -260,8 +260,10 @@ std::string TCPClientSocketHandler::get_port() const
|
||||
return this->port;
|
||||
}
|
||||
|
||||
bool TCPClientSocketHandler::match_port_pairt(const uint16_t local, const uint16_t remote) 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;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class TCPClientSocketHandler: public TCPSocketHandler
|
||||
/**
|
||||
* Whether or not this connection is using the two given TCP ports.
|
||||
*/
|
||||
bool match_port_pairt(const uint16_t local, const uint16_t remote) const;
|
||||
bool match_port_pair(const uint16_t local, const uint16_t remote) const;
|
||||
|
||||
protected:
|
||||
bool hostname_resolution_failed;
|
||||
|
||||
Reference in New Issue
Block a user