added support for server disconnection
This commit is contained in:
parent
c17413afe3
commit
b5bae73ab3
6 changed files with 46 additions and 12 deletions
|
@ -1,5 +1,6 @@
|
||||||
3.3.10
|
3.3.10
|
||||||
|
|
||||||
|
- added support for server disconnection
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,10 @@ QObject::connect ( &Channel, SIGNAL ( OpusSupported() ),
|
||||||
SIGNAL ( CLPingWithNumClientsReceived ( CHostAddress, int, int ) ),
|
SIGNAL ( CLPingWithNumClientsReceived ( CHostAddress, int, int ) ),
|
||||||
this, SLOT ( OnCLPingWithNumClientsReceived ( CHostAddress, int, int ) ) );
|
this, SLOT ( OnCLPingWithNumClientsReceived ( CHostAddress, int, int ) ) );
|
||||||
|
|
||||||
|
QObject::connect ( &ConnLessProtocol,
|
||||||
|
SIGNAL ( CLDisconnection ( CHostAddress ) ),
|
||||||
|
this, SLOT ( OnCLDisconnection ( CHostAddress ) ) );
|
||||||
|
|
||||||
#ifdef ENABLE_CLIENT_VERSION_AND_OS_DEBUGGING
|
#ifdef ENABLE_CLIENT_VERSION_AND_OS_DEBUGGING
|
||||||
QObject::connect ( &ConnLessProtocol,
|
QObject::connect ( &ConnLessProtocol,
|
||||||
SIGNAL ( CLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString ) ),
|
SIGNAL ( CLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString ) ),
|
||||||
|
|
|
@ -399,6 +399,7 @@ public slots:
|
||||||
void OnJittBufSizeChanged ( int iNewJitBufSize );
|
void OnJittBufSizeChanged ( int iNewJitBufSize );
|
||||||
void OnReqChanInfo() { Channel.SetRemoteInfo ( ChannelInfo ); }
|
void OnReqChanInfo() { Channel.SetRemoteInfo ( ChannelInfo ); }
|
||||||
void OnNewConnection();
|
void OnNewConnection();
|
||||||
|
void OnCLDisconnection ( CHostAddress InetAddr ) { if ( InetAddr == Channel.GetAddress() ) { Stop(); } }
|
||||||
void OnCLPingReceived ( CHostAddress InetAddr,
|
void OnCLPingReceived ( CHostAddress InetAddr,
|
||||||
int iMs );
|
int iMs );
|
||||||
|
|
||||||
|
|
16
src/main.cpp
16
src/main.cpp
|
@ -57,6 +57,7 @@ int main ( int argc, char** argv )
|
||||||
bool bUseGUI = true;
|
bool bUseGUI = true;
|
||||||
bool bStartMinimized = false;
|
bool bStartMinimized = false;
|
||||||
bool bShowComplRegConnList = false;
|
bool bShowComplRegConnList = false;
|
||||||
|
bool bDisconnectAllClients = false;
|
||||||
bool bShowAnalyzerConsole = false;
|
bool bShowAnalyzerConsole = false;
|
||||||
bool bCentServPingServerInList = false;
|
bool bCentServPingServerInList = false;
|
||||||
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
|
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
|
||||||
|
@ -174,6 +175,20 @@ int main ( int argc, char** argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Disconnect all clients (emergency mode) -----------------------------
|
||||||
|
// Undocumented debugging command line argument: Needed to disconnect
|
||||||
|
// an unwanted client.
|
||||||
|
if ( GetFlagArgument ( argv,
|
||||||
|
i,
|
||||||
|
"--disconnectall", // no short form
|
||||||
|
"--disconnectall" ) )
|
||||||
|
{
|
||||||
|
bDisconnectAllClients = true;
|
||||||
|
tsConsole << "- disconnect all clients" << endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Show analyzer console -----------------------------------------------
|
// Show analyzer console -----------------------------------------------
|
||||||
// Undocumented debugging command line argument: Show the analyzer
|
// Undocumented debugging command line argument: Show the analyzer
|
||||||
// console to debug network buffer properties.
|
// console to debug network buffer properties.
|
||||||
|
@ -448,6 +463,7 @@ int main ( int argc, char** argv )
|
||||||
strServerInfo,
|
strServerInfo,
|
||||||
strWelcomeMessage,
|
strWelcomeMessage,
|
||||||
bCentServPingServerInList,
|
bCentServPingServerInList,
|
||||||
|
bDisconnectAllClients,
|
||||||
eLicenceType );
|
eLicenceType );
|
||||||
|
|
||||||
if ( bUseGUI )
|
if ( bUseGUI )
|
||||||
|
|
|
@ -207,19 +207,21 @@ CServer::CServer ( const int iNewMaxNumChan,
|
||||||
const QString& strServerInfo,
|
const QString& strServerInfo,
|
||||||
const QString& strNewWelcomeMessage,
|
const QString& strNewWelcomeMessage,
|
||||||
const bool bNCentServPingServerInList,
|
const bool bNCentServPingServerInList,
|
||||||
|
const bool bNDisconnectAllClients,
|
||||||
const ELicenceType eNLicenceType ) :
|
const ELicenceType eNLicenceType ) :
|
||||||
iMaxNumChannels ( iNewMaxNumChan ),
|
iMaxNumChannels ( iNewMaxNumChan ),
|
||||||
Socket ( this, iPortNumber ),
|
Socket ( this, iPortNumber ),
|
||||||
bWriteStatusHTMLFile ( false ),
|
bWriteStatusHTMLFile ( false ),
|
||||||
ServerListManager ( iPortNumber,
|
ServerListManager ( iPortNumber,
|
||||||
strCentralServer,
|
strCentralServer,
|
||||||
strServerInfo,
|
strServerInfo,
|
||||||
iNewMaxNumChan,
|
iNewMaxNumChan,
|
||||||
bNCentServPingServerInList,
|
bNCentServPingServerInList,
|
||||||
&ConnLessProtocol ),
|
&ConnLessProtocol ),
|
||||||
bAutoRunMinimized ( false ),
|
bAutoRunMinimized ( false ),
|
||||||
strWelcomeMessage ( strNewWelcomeMessage ),
|
strWelcomeMessage ( strNewWelcomeMessage ),
|
||||||
eLicenceType ( eNLicenceType )
|
eLicenceType ( eNLicenceType ),
|
||||||
|
bDisconnectAllClients ( bNDisconnectAllClients )
|
||||||
{
|
{
|
||||||
int iOpusError;
|
int iOpusError;
|
||||||
int i;
|
int i;
|
||||||
|
@ -560,6 +562,14 @@ void CServer::OnSendProtMessage ( int iChID, CVector<uint8_t> vecMessage )
|
||||||
void CServer::OnNewConnection ( int iChID,
|
void CServer::OnNewConnection ( int iChID,
|
||||||
CHostAddress RecHostAddr )
|
CHostAddress RecHostAddr )
|
||||||
{
|
{
|
||||||
|
// in the special case that all clients shall be disconnected, just send the
|
||||||
|
// disconnect message and leave this function
|
||||||
|
if ( bDisconnectAllClients )
|
||||||
|
{
|
||||||
|
ConnLessProtocol.CreateCLDisconnection ( RecHostAddr );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// on a new connection we query the network transport properties for the
|
// on a new connection we query the network transport properties for the
|
||||||
// audio packets (to use the correct network block size and audio
|
// audio packets (to use the correct network block size and audio
|
||||||
// compression properties, etc.)
|
// compression properties, etc.)
|
||||||
|
|
|
@ -131,6 +131,7 @@ public:
|
||||||
const QString& strServerInfo,
|
const QString& strServerInfo,
|
||||||
const QString& strNewWelcomeMessage,
|
const QString& strNewWelcomeMessage,
|
||||||
const bool bNCentServPingServerInList,
|
const bool bNCentServPingServerInList,
|
||||||
|
const bool bNDisconnectAllClients,
|
||||||
const ELicenceType eNLicenceType );
|
const ELicenceType eNLicenceType );
|
||||||
|
|
||||||
void Start();
|
void Start();
|
||||||
|
@ -273,6 +274,7 @@ protected:
|
||||||
// messaging
|
// messaging
|
||||||
QString strWelcomeMessage;
|
QString strWelcomeMessage;
|
||||||
ELicenceType eLicenceType;
|
ELicenceType eLicenceType;
|
||||||
|
bool bDisconnectAllClients;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Started();
|
void Started();
|
||||||
|
|
Loading…
Reference in a new issue