From 053362e604c98c229df57337ba7752d4d6b97fa8 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Mon, 26 Jan 2015 14:46:20 +0100 Subject: Added network termination called at app exit. This fixes a crash in MSVC runtime caused by joining a thread in a global var's destructor. --- tests/Network/EchoServer.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests/Network/EchoServer.cpp') diff --git a/tests/Network/EchoServer.cpp b/tests/Network/EchoServer.cpp index 728db0b7c..5f4b7651d 100644 --- a/tests/Network/EchoServer.cpp +++ b/tests/Network/EchoServer.cpp @@ -7,6 +7,7 @@ #include #include #include "OSSupport/Network.h" +#include "OSSupport/NetworkSingleton.h" @@ -98,7 +99,7 @@ class cEchoServerCallbacks: -int main() +void DoTest(void) { LOGD("EchoServer: starting up"); cServerHandlePtr Server = cNetwork::Listen(9876, std::make_shared()); @@ -119,9 +120,20 @@ int main() Server->Close(); ASSERT(!Server->IsListening()); LOGD("Server has been closed."); +} + + + + + +int main() +{ + DoTest(); printf("Press enter to exit test.\n"); + AString line; std::getline(std::cin, line); + cNetworkSingleton::Get().Terminate(); LOG("Network test finished."); return 0; -- cgit v1.2.3 From 014b96adb33fa902072d9f35661bc4f5e7c323e8 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 30 Jan 2015 21:24:02 +0100 Subject: Exported cServerHandle and cNetwork:Listen to Lua. Also added an example to the NetworkTest plugin. --- tests/Network/EchoServer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/Network/EchoServer.cpp') diff --git a/tests/Network/EchoServer.cpp b/tests/Network/EchoServer.cpp index 5f4b7651d..49fb89122 100644 --- a/tests/Network/EchoServer.cpp +++ b/tests/Network/EchoServer.cpp @@ -119,6 +119,7 @@ void DoTest(void) LOG("Server terminating."); Server->Close(); ASSERT(!Server->IsListening()); + Server.reset(); LOGD("Server has been closed."); } -- cgit v1.2.3 From 591b4eeb8a82d1a15c22394683f151d4186489e4 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 20 Feb 2015 16:08:21 +0100 Subject: Network tests: Fixed clang warnings. --- tests/Network/EchoServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/Network/EchoServer.cpp') diff --git a/tests/Network/EchoServer.cpp b/tests/Network/EchoServer.cpp index 49fb89122..2a420fbac 100644 --- a/tests/Network/EchoServer.cpp +++ b/tests/Network/EchoServer.cpp @@ -99,7 +99,7 @@ class cEchoServerCallbacks: -void DoTest(void) +static void DoTest(void) { LOGD("EchoServer: starting up"); cServerHandlePtr Server = cNetwork::Listen(9876, std::make_shared()); -- cgit v1.2.3