Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ class CServer : public QObject, public CServerSlots<MAX_NUM_CHANNELS>
void SetEnableDelayPanning ( bool bDelayPanningOn ) { bDelayPan = bDelayPanningOn; }
bool IsDelayPanningEnabled() { return bDelayPan; }

CServerLogging* GetLogging() { return &Logging; }


protected:
// access functions for actual channels
bool IsConnected ( const int iChanNum ) { return vecChannels[iChanNum].IsConnected(); }
Expand Down
11 changes: 11 additions & 0 deletions src/serverlogging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ void CServerLogging::AddNewConnection ( const QHostAddress& ClientInetAddr, cons
*this << strLogStr; // in log file
}


void CServerLogging::AddEarlyConnection(const QHostAddress& ClientInetAddr, int iNumberOfConnectedClients)
{
const QString strLogStr =
CurTimeDatetoLogString() + ", " + ClientInetAddr.toString() + ", new connection detected (" + QString::number(iNumberOfConnectedClients) + ")";
qInfo() << qUtf8Printable(strLogStr); // Console
*this << strLogStr; // Log file (uses operator<<, which is protected but accessible here)
}



void CServerLogging::AddServerStopped()
{
const QString strLogStr = CurTimeDatetoLogString() + ",, server idling "
Expand Down
2 changes: 2 additions & 0 deletions src/serverlogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class CServerLogging
void AddServerStopped();

void AddNewConnection ( const QHostAddress& ClientInetAddr, const int iNumberOfConnectedClients );
void AddEarlyConnection(const QHostAddress& ClientInetAddr, int iNumberOfConnectedClients);


protected:
void operator<< ( const QString& sNewStr );
Expand Down
8 changes: 6 additions & 2 deletions src/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,12 @@ void CSocket::OnDataReceived()

if ( pServer->PutAudioData ( vecbyRecBuf, iNumBytesRead, RecHostAddr, iCurChanID ) )
{
// we have a new connection, emit a signal
emit NewConnection ( iCurChanID, pServer->GetNumberOfConnectedClients(), RecHostAddr );
// EARLY LOG: Announce new connection as soon as detected
pServer->GetLogging()->AddEarlyConnection(RecHostAddr.InetAddr, pServer->GetNumberOfConnectedClients());

QThread::msleep(250);

emit NewConnection(iCurChanID, pServer->GetNumberOfConnectedClients(), RecHostAddr);

// this was an audio packet, start server if it is in sleep mode
if ( !pServer->IsRunning() )
Expand Down