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
|
||||
|
||||
- added support for server disconnection
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -211,6 +211,10 @@ QObject::connect ( &Channel, SIGNAL ( OpusSupported() ),
|
|||
SIGNAL ( CLPingWithNumClientsReceived ( 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
|
||||
QObject::connect ( &ConnLessProtocol,
|
||||
SIGNAL ( CLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString ) ),
|
||||
|
|
|
@ -399,6 +399,7 @@ public slots:
|
|||
void OnJittBufSizeChanged ( int iNewJitBufSize );
|
||||
void OnReqChanInfo() { Channel.SetRemoteInfo ( ChannelInfo ); }
|
||||
void OnNewConnection();
|
||||
void OnCLDisconnection ( CHostAddress InetAddr ) { if ( InetAddr == Channel.GetAddress() ) { Stop(); } }
|
||||
void OnCLPingReceived ( CHostAddress InetAddr,
|
||||
int iMs );
|
||||
|
||||
|
|
16
src/main.cpp
16
src/main.cpp
|
@ -57,6 +57,7 @@ int main ( int argc, char** argv )
|
|||
bool bUseGUI = true;
|
||||
bool bStartMinimized = false;
|
||||
bool bShowComplRegConnList = false;
|
||||
bool bDisconnectAllClients = false;
|
||||
bool bShowAnalyzerConsole = false;
|
||||
bool bCentServPingServerInList = false;
|
||||
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 -----------------------------------------------
|
||||
// Undocumented debugging command line argument: Show the analyzer
|
||||
// console to debug network buffer properties.
|
||||
|
@ -448,6 +463,7 @@ int main ( int argc, char** argv )
|
|||
strServerInfo,
|
||||
strWelcomeMessage,
|
||||
bCentServPingServerInList,
|
||||
bDisconnectAllClients,
|
||||
eLicenceType );
|
||||
|
||||
if ( bUseGUI )
|
||||
|
|
|
@ -207,6 +207,7 @@ CServer::CServer ( const int iNewMaxNumChan,
|
|||
const QString& strServerInfo,
|
||||
const QString& strNewWelcomeMessage,
|
||||
const bool bNCentServPingServerInList,
|
||||
const bool bNDisconnectAllClients,
|
||||
const ELicenceType eNLicenceType ) :
|
||||
iMaxNumChannels ( iNewMaxNumChan ),
|
||||
Socket ( this, iPortNumber ),
|
||||
|
@ -219,7 +220,8 @@ CServer::CServer ( const int iNewMaxNumChan,
|
|||
&ConnLessProtocol ),
|
||||
bAutoRunMinimized ( false ),
|
||||
strWelcomeMessage ( strNewWelcomeMessage ),
|
||||
eLicenceType ( eNLicenceType )
|
||||
eLicenceType ( eNLicenceType ),
|
||||
bDisconnectAllClients ( bNDisconnectAllClients )
|
||||
{
|
||||
int iOpusError;
|
||||
int i;
|
||||
|
@ -560,6 +562,14 @@ void CServer::OnSendProtMessage ( int iChID, CVector<uint8_t> vecMessage )
|
|||
void CServer::OnNewConnection ( int iChID,
|
||||
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
|
||||
// audio packets (to use the correct network block size and audio
|
||||
// compression properties, etc.)
|
||||
|
|
|
@ -131,6 +131,7 @@ public:
|
|||
const QString& strServerInfo,
|
||||
const QString& strNewWelcomeMessage,
|
||||
const bool bNCentServPingServerInList,
|
||||
const bool bNDisconnectAllClients,
|
||||
const ELicenceType eNLicenceType );
|
||||
|
||||
void Start();
|
||||
|
@ -273,6 +274,7 @@ protected:
|
|||
// messaging
|
||||
QString strWelcomeMessage;
|
||||
ELicenceType eLicenceType;
|
||||
bool bDisconnectAllClients;
|
||||
|
||||
signals:
|
||||
void Started();
|
||||
|
|
Loading…
Reference in a new issue