making sure that the client connect loop and server accept is stopped early at ndbd shutdown

parent 6c7e13de
...@@ -183,11 +183,9 @@ int main(int argc, char** argv) ...@@ -183,11 +183,9 @@ int main(int argc, char** argv)
assert("Illegal state globalData.theRestartFlag" == 0); assert("Illegal state globalData.theRestartFlag" == 0);
} }
SocketServer socket_server;
globalTransporterRegistry.startSending(); globalTransporterRegistry.startSending();
globalTransporterRegistry.startReceiving(); globalTransporterRegistry.startReceiving();
if (!globalTransporterRegistry.start_service(socket_server)){ if (!globalTransporterRegistry.start_service(*globalEmulatorData.m_socket_server)){
ndbout_c("globalTransporterRegistry.start_service() failed"); ndbout_c("globalTransporterRegistry.start_service() failed");
exit(-1); exit(-1);
} }
...@@ -199,7 +197,7 @@ int main(int argc, char** argv) ...@@ -199,7 +197,7 @@ int main(int argc, char** argv)
globalEmulatorData.theWatchDog->doStart(); globalEmulatorData.theWatchDog->doStart();
socket_server.startServer(); globalEmulatorData.m_socket_server->startServer();
// theConfig->closeConfiguration(); // theConfig->closeConfiguration();
...@@ -207,11 +205,6 @@ int main(int argc, char** argv) ...@@ -207,11 +205,6 @@ int main(int argc, char** argv)
NdbShutdown(NST_Normal); NdbShutdown(NST_Normal);
socket_server.stopServer();
socket_server.stopSessions();
globalTransporterRegistry.stop_clients();
return NRT_Default; return NRT_Default;
} }
......
...@@ -68,6 +68,7 @@ EmulatorData::EmulatorData(){ ...@@ -68,6 +68,7 @@ EmulatorData::EmulatorData(){
theThreadConfig = 0; theThreadConfig = 0;
theSimBlockList = 0; theSimBlockList = 0;
theShutdownMutex = 0; theShutdownMutex = 0;
m_socket_server = 0;
} }
void void
...@@ -83,6 +84,7 @@ EmulatorData::create(){ ...@@ -83,6 +84,7 @@ EmulatorData::create(){
theWatchDog = new WatchDog(); theWatchDog = new WatchDog();
theThreadConfig = new ThreadConfig(); theThreadConfig = new ThreadConfig();
theSimBlockList = new SimBlockList(); theSimBlockList = new SimBlockList();
m_socket_server = new SocketServer();
theShutdownMutex = NdbMutex_Create(); theShutdownMutex = NdbMutex_Create();
...@@ -99,7 +101,8 @@ EmulatorData::destroy(){ ...@@ -99,7 +101,8 @@ EmulatorData::destroy(){
delete theThreadConfig; theThreadConfig = 0; delete theThreadConfig; theThreadConfig = 0;
if(theSimBlockList) if(theSimBlockList)
delete theSimBlockList; theSimBlockList = 0; delete theSimBlockList; theSimBlockList = 0;
if(m_socket_server)
delete m_socket_server; m_socket_server = 0;
NdbMem_Destroy(); NdbMem_Destroy();
} }
...@@ -195,9 +198,22 @@ NdbShutdown(NdbShutdownType type, ...@@ -195,9 +198,22 @@ NdbShutdown(NdbShutdownType type,
fclose(outputStream); fclose(outputStream);
#endif #endif
/**
* Stop all transporter connection attempts and accepts
*/
globalEmulatorData.m_socket_server->stopServer();
globalEmulatorData.m_socket_server->stopSessions();
globalTransporterRegistry.stop_clients();
/**
* Stop transporter communication with other nodes
*/
globalTransporterRegistry.stopSending(); globalTransporterRegistry.stopSending();
globalTransporterRegistry.stopReceiving(); globalTransporterRegistry.stopReceiving();
/**
* Remove all transporters
*/
globalTransporterRegistry.removeAll(); globalTransporterRegistry.removeAll();
#ifdef VM_TRACE #ifdef VM_TRACE
......
...@@ -55,6 +55,7 @@ struct EmulatorData { ...@@ -55,6 +55,7 @@ struct EmulatorData {
class WatchDog * theWatchDog; class WatchDog * theWatchDog;
class ThreadConfig * theThreadConfig; class ThreadConfig * theThreadConfig;
class SimBlockList * theSimBlockList; class SimBlockList * theSimBlockList;
class SocketServer * m_socket_server;
/** /**
* Constructor * Constructor
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment