diff --git a/src/servers/Server_Common/Database/DbWorkerPool.cpp b/src/servers/Server_Common/Database/DbWorkerPool.cpp index 003cb3af..575bf457 100644 --- a/src/servers/Server_Common/Database/DbWorkerPool.cpp +++ b/src/servers/Server_Common/Database/DbWorkerPool.cpp @@ -210,7 +210,7 @@ boost::shared_ptr< T > Core::Db::DbWorkerPool< T >::getFreeConnection() { connection = m_connections[IDX_SYNCH][i++ % numCons]; - if (connection->lockIfReady()) + if( connection->lockIfReady() ) break; } diff --git a/src/servers/Server_Zone/ServerZone.cpp b/src/servers/Server_Zone/ServerZone.cpp index fe2bb905..d87b711b 100644 --- a/src/servers/Server_Zone/ServerZone.cpp +++ b/src/servers/Server_Zone/ServerZone.cpp @@ -44,7 +44,8 @@ Core::Db::DbWorkerPool< Core::Db::CharaDbConnection > g_charaDb; Core::ServerZone::ServerZone( const std::string& configPath ) : m_configPath( configPath ), - m_bRunning( true ) + m_bRunning( true ), + m_lastDBPingTime( 0 ) { m_pConfig = XMLConfigPtr( new XMLConfig ); } @@ -272,6 +273,12 @@ void Core::ServerZone::mainLoop() } } + if( currTime - m_lastDBPingTime > 3 ) + { + g_charaDb.keepAlive(); + m_lastDBPingTime = currTime; + } + auto it = this->m_sessionMap.begin(); for( ; it != this->m_sessionMap.end(); ) diff --git a/src/servers/Server_Zone/ServerZone.h b/src/servers/Server_Zone/ServerZone.h index 00f3e41c..632409e1 100644 --- a/src/servers/Server_Zone/ServerZone.h +++ b/src/servers/Server_Zone/ServerZone.h @@ -51,6 +51,7 @@ namespace Core { uint16_t m_port; std::string m_ip; + uint32_t m_lastDBPingTime; bool m_bRunning;