unregistering the server does work now correctly
This commit is contained in:
parent
ed74f3e370
commit
97d32de751
4 changed files with 47 additions and 24 deletions
|
@ -228,9 +228,21 @@ void CLlconServerDlg::OnDefaultCentralServerStateChanged ( int value )
|
||||||
|
|
||||||
void CLlconServerDlg::OnRegisterServerStateChanged ( int value )
|
void CLlconServerDlg::OnRegisterServerStateChanged ( int value )
|
||||||
{
|
{
|
||||||
|
const bool bRegState = ( value == Qt::Checked );
|
||||||
|
|
||||||
// apply new setting to the server and update it
|
// apply new setting to the server and update it
|
||||||
pServer->SetServerListEnabled ( value == Qt::Checked );
|
pServer->SetServerListEnabled ( bRegState );
|
||||||
|
|
||||||
|
// If registering is enabled, update data. If registering is disabled,
|
||||||
|
// unregister slave server
|
||||||
|
if ( bRegState )
|
||||||
|
{
|
||||||
pServer->UpdateServerList();
|
pServer->UpdateServerList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pServer->UnregisterSlaveServer();
|
||||||
|
}
|
||||||
|
|
||||||
// update GUI dependencies
|
// update GUI dependencies
|
||||||
UpdateGUIDependencies();
|
UpdateGUIDependencies();
|
||||||
|
|
|
@ -130,6 +130,8 @@ public:
|
||||||
// Server list management --------------------------------------------------
|
// Server list management --------------------------------------------------
|
||||||
void UpdateServerList() { ServerListManager.Update(); }
|
void UpdateServerList() { ServerListManager.Update(); }
|
||||||
|
|
||||||
|
void UnregisterSlaveServer() { ServerListManager.SlaveServerUnregister(); }
|
||||||
|
|
||||||
void SetServerListEnabled ( const bool bState )
|
void SetServerListEnabled ( const bool bState )
|
||||||
{ ServerListManager.SetEnabled ( bState ); }
|
{ ServerListManager.SetEnabled ( bState ); }
|
||||||
|
|
||||||
|
|
|
@ -376,14 +376,12 @@ void CServerListManager::CentralServerQueryServerList ( const CHostAddress& Inet
|
||||||
|
|
||||||
|
|
||||||
/* Slave server functionality *************************************************/
|
/* Slave server functionality *************************************************/
|
||||||
void CServerListManager::OnTimerRegistering()
|
void CServerListManager::SlaveServerRegisterServer ( const bool bIsRegister )
|
||||||
{
|
{
|
||||||
// we need the lock since the user might change the server properties at
|
// we need the lock since the user might change the server properties at
|
||||||
// any time
|
// any time
|
||||||
QMutexLocker locker ( &Mutex );
|
QMutexLocker locker ( &Mutex );
|
||||||
|
|
||||||
if ( !bIsCentralServer && bEnabled )
|
|
||||||
{
|
|
||||||
// get the correct central server address
|
// get the correct central server address
|
||||||
QString strCurCentrServAddr;
|
QString strCurCentrServAddr;
|
||||||
if ( bUseDefaultCentralServerAddress )
|
if ( bUseDefaultCentralServerAddress )
|
||||||
|
@ -405,8 +403,16 @@ void CServerListManager::OnTimerRegistering()
|
||||||
if ( LlconNetwUtil().ParseNetworkAddress ( strCurCentrServAddr,
|
if ( LlconNetwUtil().ParseNetworkAddress ( strCurCentrServAddr,
|
||||||
HostAddress ) )
|
HostAddress ) )
|
||||||
{
|
{
|
||||||
|
if ( bIsRegister )
|
||||||
|
{
|
||||||
|
// register server
|
||||||
pConnLessProtocol->CreateCLRegisterServerMes ( HostAddress,
|
pConnLessProtocol->CreateCLRegisterServerMes ( HostAddress,
|
||||||
ServerList[0] );
|
ServerList[0] );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// unregister server
|
||||||
|
pConnLessProtocol->CreateCLUnregisterServerMes ( HostAddress );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,7 @@ public:
|
||||||
|
|
||||||
void CentralServerQueryServerList ( const CHostAddress& InetAddr );
|
void CentralServerQueryServerList ( const CHostAddress& InetAddr );
|
||||||
|
|
||||||
|
void SlaveServerUnregister() { SlaveServerRegisterServer ( false ); }
|
||||||
|
|
||||||
// set server infos -> per definition the server info of this server is
|
// set server infos -> per definition the server info of this server is
|
||||||
// stored in the first entry of the list, we assume here that the first
|
// stored in the first entry of the list, we assume here that the first
|
||||||
|
@ -170,6 +171,8 @@ public:
|
||||||
QLocale::Country GetServerCountry() { return ServerList[0].eCountry; }
|
QLocale::Country GetServerCountry() { return ServerList[0].eCountry; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void SlaveServerRegisterServer ( const bool bIsRegister );
|
||||||
|
|
||||||
QTimer TimerPollList;
|
QTimer TimerPollList;
|
||||||
QTimer TimerRegistering;
|
QTimer TimerRegistering;
|
||||||
QMutex Mutex;
|
QMutex Mutex;
|
||||||
|
@ -184,7 +187,7 @@ protected:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void OnTimerPollList();
|
void OnTimerPollList();
|
||||||
void OnTimerRegistering();
|
void OnTimerRegistering() { SlaveServerRegisterServer ( true ); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* !defined ( SERVERLIST_HOIJH8OUWEF_WFEIOBU_3_43445KJIUHF1912__INCLUDED_ ) */
|
#endif /* !defined ( SERVERLIST_HOIJH8OUWEF_WFEIOBU_3_43445KJIUHF1912__INCLUDED_ ) */
|
||||||
|
|
Loading…
Reference in a new issue