From da1a38a88b7bd4343fd4089ea1c3146c79b86bf6 Mon Sep 17 00:00:00 2001 From: iamsi Date: Fri, 12 Mar 2021 01:51:26 +0000 Subject: [PATCH] Fix multiple connections from the same IP [Issue 2] --- src/cclient.cpp | 1 + src/cclients.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cclient.cpp b/src/cclient.cpp index eb60948..2b249f5 100644 --- a/src/cclient.cpp +++ b/src/cclient.cpp @@ -77,6 +77,7 @@ bool CClient::operator ==(const CClient &client) const { return ((client.m_Callsign == m_Callsign) && (client.m_Ip == m_Ip) && + (client.m_Ip.GetPort() == m_Ip.GetPort()) && (client.m_ReflectorModule == m_ReflectorModule)); } diff --git a/src/cclients.cpp b/src/cclients.cpp index f41f25d..61cc9fd 100644 --- a/src/cclients.cpp +++ b/src/cclients.cpp @@ -122,7 +122,8 @@ std::shared_ptr CClients::FindClient(const CIp &Ip) // find client for ( auto it=begin(); it!=end(); it++ ) { - if ( (*it)->GetIp() == Ip ) + // check the port too to allow multiple clients from the same ip + if ( ((*it)->GetIp() == Ip) && ((*it)->GetIp().GetPort() == Ip.GetPort()) ) { return *it; }