automatic server setting for permanent server flag in the protocol

This commit is contained in:
Volker Fischer 2016-02-09 16:09:59 +00:00
parent 9ab7164d05
commit be63533c82
5 changed files with 17 additions and 1 deletions

View file

@ -9,6 +9,8 @@
- the Musicians value in the server list shows a warning if the server is full - the Musicians value in the server list shows a warning if the server is full
- automatic server setting for permanent server flag in the protocol
- bug fix: ping time measurement may be invalid for the Linux OS - bug fix: ping time measurement may be invalid for the Linux OS

View file

@ -290,7 +290,8 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
// Do not enable this for official versions! // Do not enable this for official versions!
#if 0 #if 0
strLocation += ", " + vecServerInfo[iIdx].HostAddr.InetAddr.toString() + strLocation += ", " + vecServerInfo[iIdx].HostAddr.InetAddr.toString() +
":" + QString().setNum ( vecServerInfo[iIdx].HostAddr.iPort ); ":" + QString().setNum ( vecServerInfo[iIdx].HostAddr.iPort ) +
", perm: " + QString().setNum ( vecServerInfo[iIdx].bPermanentOnline );
#endif #endif
pNewListViewItem->setText ( 3, strLocation ); pNewListViewItem->setText ( 3, strLocation );

View file

@ -204,6 +204,9 @@ LED bar: lbr
// time until a slave server registers in the server list // time until a slave server registers in the server list
#define SERVLIST_REGIST_INTERV_MINUTES 15 // minutes #define SERVLIST_REGIST_INTERV_MINUTES 15 // minutes
// defines the minimum time a server must run to be a permanent server
#define SERVLIST_TIME_PERMSERV_MINUTES 1440 // minutes, 1440 = 60 min * 24 h
// length of the moving average buffer for response time measurement // length of the moving average buffer for response time measurement
#define TIME_MOV_AV_RESPONSE_SECONDS 30 // seconds #define TIME_MOV_AV_RESPONSE_SECONDS 30 // seconds

View file

@ -151,6 +151,15 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum,
iNumPredefinedServers++; iNumPredefinedServers++;
} }
// for slave servers start the one shot timer for determining if it is a
// permanent server
if ( !GetIsCentralServer() )
{
// 1 minute = 60 * 1000 ms
QTimer::singleShot ( SERVLIST_TIME_PERMSERV_MINUTES * 60000,
this, SLOT ( OnTimerIsPermanent() ) );
}
// Connections ------------------------------------------------------------- // Connections -------------------------------------------------------------
QObject::connect ( &TimerPollList, SIGNAL ( timeout() ), QObject::connect ( &TimerPollList, SIGNAL ( timeout() ),

View file

@ -206,6 +206,7 @@ public slots:
void OnTimerPingServerInList(); void OnTimerPingServerInList();
void OnTimerPingCentralServer(); void OnTimerPingCentralServer();
void OnTimerRegistering() { SlaveServerRegisterServer ( true ); } void OnTimerRegistering() { SlaveServerRegisterServer ( true ); }
void OnTimerIsPermanent() { ServerList[0].bPermanentOnline = true; }
}; };
#endif /* !defined ( SERVERLIST_HOIJH8OUWEF_WFEIOBU_3_43445KJIUHF1912__INCLUDED_ ) */ #endif /* !defined ( SERVERLIST_HOIJH8OUWEF_WFEIOBU_3_43445KJIUHF1912__INCLUDED_ ) */