diff --git a/src/server.cpp b/src/server.cpp index 504e736994..cdb0defc60 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -562,7 +562,7 @@ void CServer::SendProtMessage ( int iChID, CVector vecMessage ) Socket.SendPacket ( vecMessage, vecChannels[iChID].GetAddress() ); } -void CServer::OnNewConnection ( int iChID, CHostAddress RecHostAddr ) +void CServer::OnNewConnection ( int iChID, int iTotChans, CHostAddress RecHostAddr ) { QMutexLocker locker ( &Mutex ); @@ -637,7 +637,7 @@ void CServer::OnNewConnection ( int iChID, CHostAddress RecHostAddr ) DoubleFrameSizeConvBufOut[iChID].Reset(); // logging of new connected channel - Logging.AddNewConnection ( RecHostAddr.InetAddr, GetNumberOfConnectedClients() ); + Logging.AddNewConnection ( RecHostAddr.InetAddr, iTotChans ); } void CServer::OnServerFull ( CHostAddress RecHostAddr ) diff --git a/src/server.h b/src/server.h index 1f10747b00..b33c0fc841 100644 --- a/src/server.h +++ b/src/server.h @@ -181,6 +181,8 @@ class CServer : public QObject, public CServerSlots bool PutAudioData ( const CVector& vecbyRecBuf, const int iNumBytesRead, const CHostAddress& HostAdr, int& iCurChanID ); + int GetNumberOfConnectedClients(); + void GetConCliParam ( CVector& vecHostAddresses, CVector& vecsName, CVector& veciJitBufNumFrames, @@ -261,7 +263,6 @@ class CServer : public QObject, public CServerSlots void InitChannel ( const int iNewChanID, const CHostAddress& InetAddr ); void FreeChannel ( const int iCurChanID ); void DumpChannels ( const QString& title ); - int GetNumberOfConnectedClients(); CVector CreateChannelList(); virtual void CreateAndSendChanListForAllConChannels(); @@ -413,7 +414,7 @@ class CServer : public QObject, public CServerSlots public slots: void OnTimer(); - void OnNewConnection ( int iChID, CHostAddress RecHostAddr ); + void OnNewConnection ( int iChID, int iTotChans, CHostAddress RecHostAddr ); void OnServerFull ( CHostAddress RecHostAddr ); diff --git a/src/socket.cpp b/src/socket.cpp index 3a6622f91a..146ed06782 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -69,7 +69,10 @@ CSocket::CSocket ( CServer* pNServP, const quint16 iPortNumber, const quint16 iQ QObject::connect ( this, &CSocket::ProtcolCLMessageReceived, pServer, &CServer::OnProtcolCLMessageReceived ); - QObject::connect ( this, static_cast ( &CSocket::NewConnection ), pServer, &CServer::OnNewConnection ); + QObject::connect ( this, + static_cast ( &CSocket::NewConnection ), + pServer, + &CServer::OnNewConnection ); QObject::connect ( this, &CSocket::ServerFull, pServer, &CServer::OnServerFull ); } @@ -463,7 +466,7 @@ void CSocket::OnDataReceived() if ( pServer->PutAudioData ( vecbyRecBuf, iNumBytesRead, RecHostAddr, iCurChanID ) ) { // we have a new connection, emit a signal - emit NewConnection ( iCurChanID, RecHostAddr ); + emit NewConnection ( iCurChanID, pServer->GetNumberOfConnectedClients(), RecHostAddr ); // this was an audio packet, start server if it is in sleep mode if ( !pServer->IsRunning() ) diff --git a/src/socket.h b/src/socket.h index c29df14d9d..fee83488ce 100644 --- a/src/socket.h +++ b/src/socket.h @@ -97,7 +97,7 @@ class CSocket : public QObject signals: void NewConnection(); // for the client - void NewConnection ( int iChID, + void NewConnection ( int iChID, int iTotChans, CHostAddress RecHostAddr ); // for the server void ServerFull ( CHostAddress RecHostAddr ); diff --git a/src/util.cpp b/src/util.cpp index 5302e9fd03..ffe7ec5edb 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -922,7 +922,7 @@ int CHostAddress::Compare ( const CHostAddress& other ) const quint32 thisAddr = InetAddr.toIPv4Address(); quint32 otherAddr = other.InetAddr.toIPv4Address(); - return (int) thisAddr - (int) otherAddr; + return thisAddr < otherAddr ? -1 : thisAddr > otherAddr ? 1 : 0; } // Instrument picture data base ------------------------------------------------