提交 7fb9233d 编写于 作者: 丁劲犇's avatar 丁劲犇 😸

Add a cluster-reconnection method. when cluster nodes lost all connections, it...

Add a cluster-reconnection method. when cluster nodes lost all connections, it will attempt to re-connect to target cluster every 2 mins
上级 0bb6d9b8
......@@ -365,6 +365,19 @@ void ZPMainFrame::timerEvent(QTimerEvent * e)
m_clientTable->KickDeadClients();
m_pClusterTerm->SendHeartBeatings();
m_pClusterTerm->KickDeadClients();
if (ui->action_Start_Stop->isChecked()==true)
{
//Cluster re-connection Test
QStringList lstCluster = m_pClusterTerm->SvrNames();
if (lstCluster.size()==0 && m_dtmLastClusterJoin.secsTo(QDateTime::currentDateTime())>=120)
{
QSettings settings(this->m_currentConfigFile,QSettings::IniFormat);
QString strAddr = settings.value("history/clusterAddr","192.168.1.118").toString();
QString strPort = settings.value("history/clusterPort","25600").toString();
m_pClusterTerm->JoinCluster(QHostAddress(strAddr),strPort.toInt());
m_dtmLastClusterJoin = QDateTime::currentDateTime();
}
}
m_nTimerCheck = startTimer(5000);
}
}
......@@ -373,6 +386,8 @@ void ZPMainFrame::on_action_Start_Stop_triggered(bool setordel)
if (setordel==true)
{
forkServer(m_currentConfigFile);
//Cluster Reconnection Dtm Protect
m_dtmLastClusterJoin = QDateTime::currentDateTime();
}
else
{
......@@ -815,6 +830,8 @@ void ZPMainFrame::on_actionReload_config_file_triggered()
m_currentConfigFile = filename;
LoadSettings(m_currentConfigFile);
forkServer(m_currentConfigFile);
//Cluster Reconnection Dtm Protect
m_dtmLastClusterJoin = QDateTime::currentDateTime();
}
}
void ZPMainFrame::on_pushButton_db_add_clicked()
......
......@@ -59,6 +59,8 @@ private:
ExampleServer::st_client_table * m_clientTable;
ZPDatabase::DatabaseResource * m_pDatabases;
ZP_Cluster::zp_ClusterTerm * m_pClusterTerm;
//Cluster Reconnection
QDateTime m_dtmLastClusterJoin;
int m_nTimerId;
void initUI();
void LoadSettings(QString config_file);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册