From be63533c82aa8029dc6568f6c7fdcb003aebdc3d Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Tue, 9 Feb 2016 16:09:59 +0000 Subject: [PATCH] automatic server setting for permanent server flag in the protocol --- ChangeLog | 2 ++ src/connectdlg.cpp | 3 ++- src/global.h | 3 +++ src/serverlist.cpp | 9 +++++++++ src/serverlist.h | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a239d82e..5b56360e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index b4ccb21c..692612c7 100755 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -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 ); diff --git a/src/global.h b/src/global.h index e03392a9..cedde083 100755 --- a/src/global.h +++ b/src/global.h @@ -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 diff --git a/src/serverlist.cpp b/src/serverlist.cpp index bcaef032..c0b6648a 100755 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -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() ), diff --git a/src/serverlist.h b/src/serverlist.h index ebb620e7..436af91c 100755 --- a/src/serverlist.h +++ b/src/serverlist.h @@ -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_ ) */