new command line option -d to disconnect all clients on shutdown of the server (Ticket #161)
This commit is contained in:
parent
34cccac29f
commit
599306156d
4 changed files with 82 additions and 73 deletions
|
@ -21,6 +21,8 @@
|
|||
|
||||
- new design for the About dialog (Ticket #189)
|
||||
|
||||
- new command line option -d to disconnect all clients on shutdown of the server (Ticket #161)
|
||||
|
||||
- bug fix: for mono capture jack audio interface Jamulus complains it
|
||||
cannot make connections (Ticket #137)
|
||||
|
||||
|
|
31
src/main.cpp
31
src/main.cpp
|
@ -58,7 +58,7 @@ int main ( int argc, char** argv )
|
|||
bool bUseGUI = true;
|
||||
bool bStartMinimized = false;
|
||||
bool bShowComplRegConnList = false;
|
||||
bool bDisconnectAllClients = false;
|
||||
bool bDisconnectAllClientsOnQuit = false;
|
||||
bool bUseDoubleSystemFrameSize = true; // default is 128 samples frame size
|
||||
bool bShowAnalyzerConsole = false;
|
||||
bool bCentServPingServerInList = false;
|
||||
|
@ -200,6 +200,18 @@ int main ( int argc, char** argv )
|
|||
}
|
||||
|
||||
|
||||
// Disconnect all clients on quit --------------------------------------
|
||||
if ( GetFlagArgument ( argv,
|
||||
i,
|
||||
"-d",
|
||||
"--discononquit" ) )
|
||||
{
|
||||
bDisconnectAllClientsOnQuit = true;
|
||||
tsConsole << "- disconnect all clients on quit" << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Disabling auto Jack connections -------------------------------------
|
||||
if ( GetFlagArgument ( argv,
|
||||
i,
|
||||
|
@ -239,20 +251,6 @@ 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.
|
||||
|
@ -626,7 +624,7 @@ int main ( int argc, char** argv )
|
|||
strWelcomeMessage,
|
||||
strRecordingDirName,
|
||||
bCentServPingServerInList,
|
||||
bDisconnectAllClients,
|
||||
bDisconnectAllClientsOnQuit,
|
||||
bUseDoubleSystemFrameSize,
|
||||
eLicenceType );
|
||||
if ( bUseGUI )
|
||||
|
@ -704,6 +702,7 @@ QString UsageArguments ( char **argv )
|
|||
" -v, --version output version information and exit\n"
|
||||
"\nServer only:\n"
|
||||
" -a, --servername server name, required for HTML status\n"
|
||||
" -d, --discononquit disconnect all clients on quit\n"
|
||||
" -D, --histdays number of days of history to display\n"
|
||||
" -e, --centralserver address of the central server\n"
|
||||
" -F, --fastupdate use 64 samples frame size mode\n"
|
||||
|
|
|
@ -231,7 +231,7 @@ CServer::CServer ( const int iNewMaxNumChan,
|
|||
const QString& strNewWelcomeMessage,
|
||||
const QString& strRecordingDirName,
|
||||
const bool bNCentServPingServerInList,
|
||||
const bool bNDisconnectAllClients,
|
||||
const bool bNDisconnectAllClientsOnQuit,
|
||||
const bool bNUseDoubleSystemFrameSize,
|
||||
const ELicenceType eNLicenceType ) :
|
||||
bUseDoubleSystemFrameSize ( bNUseDoubleSystemFrameSize ),
|
||||
|
@ -251,7 +251,7 @@ CServer::CServer ( const int iNewMaxNumChan,
|
|||
bAutoRunMinimized ( false ),
|
||||
strWelcomeMessage ( strNewWelcomeMessage ),
|
||||
eLicenceType ( eNLicenceType ),
|
||||
bDisconnectAllClients ( bNDisconnectAllClients ),
|
||||
bDisconnectAllClientsOnQuit ( bNDisconnectAllClientsOnQuit ),
|
||||
pSignalHandler ( CSignalHandler::getSingletonP() )
|
||||
{
|
||||
int iOpusError;
|
||||
|
@ -810,14 +810,6 @@ void CServer::SendProtMessage ( 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.)
|
||||
|
@ -918,6 +910,22 @@ void CServer::OnCLDisconnection ( CHostAddress InetAddr )
|
|||
|
||||
void CServer::OnAboutToQuit()
|
||||
{
|
||||
// if enabled, disconnect all clients on quit
|
||||
if ( bDisconnectAllClientsOnQuit )
|
||||
{
|
||||
Mutex.lock();
|
||||
{
|
||||
for ( int i = 0; i < iMaxNumChannels; i++ )
|
||||
{
|
||||
if ( vecChannels[i].IsConnected() )
|
||||
{
|
||||
ConnLessProtocol.CreateCLDisconnection ( vecChannels[i].GetAddress() );
|
||||
}
|
||||
}
|
||||
}
|
||||
Mutex.unlock(); // release mutex
|
||||
}
|
||||
|
||||
Stop();
|
||||
|
||||
// if server was registered at the central server, unregister on shutdown
|
||||
|
|
|
@ -178,7 +178,7 @@ public:
|
|||
const QString& strNewWelcomeMessage,
|
||||
const QString& strRecordingDirName,
|
||||
const bool bNCentServPingServerInList,
|
||||
const bool bNDisconnectAllClients,
|
||||
const bool bNDisconnectAllClientsOnQuit,
|
||||
const bool bNUseDoubleSystemFrameSize,
|
||||
const ELicenceType eNLicenceType );
|
||||
|
||||
|
@ -369,7 +369,7 @@ protected:
|
|||
// messaging
|
||||
QString strWelcomeMessage;
|
||||
ELicenceType eLicenceType;
|
||||
bool bDisconnectAllClients;
|
||||
bool bDisconnectAllClientsOnQuit;
|
||||
|
||||
CSignalHandler* pSignalHandler;
|
||||
|
||||
|
|
Loading…
Reference in a new issue