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
- automatic server setting for permanent server flag in the protocol
- 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!
#if 0
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
pNewListViewItem->setText ( 3, strLocation );

View File

@ -204,6 +204,9 @@ LED bar: lbr
// time until a slave server registers in the server list
#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
#define TIME_MOV_AV_RESPONSE_SECONDS 30 // seconds

View File

@ -151,6 +151,15 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum,
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 -------------------------------------------------------------
QObject::connect ( &TimerPollList, SIGNAL ( timeout() ),

View File

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