Server is multithreaded, but no connection is visible
UDPNetworkUtility and ConfigUtility are now using the ServiceLocator pattern in the server, and networkQueue() is running in a separate thread in the server. However, there seems to be a problem somewhere, since the broadcast request & response are not producing any visible output.
This commit is contained in:
+1
-3
@@ -26,9 +26,7 @@ Lobby::Lobby() {
|
||||
serverList.push_back({"bar",{0,0}});
|
||||
serverList.push_back({"foobar",{0,0}});
|
||||
|
||||
queueThread = SDL_CreateThread(networkQueue, nullptr);
|
||||
|
||||
if (!queueThread) {
|
||||
if (!(queueThread = SDL_CreateThread(networkQueue, nullptr))) {
|
||||
throw(runtime_error("Failed to create the network thread"));
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ protected:
|
||||
std::vector<ServerEntry> serverList;
|
||||
ServerEntry* selectedServer = nullptr;
|
||||
|
||||
//threads
|
||||
SDL_Thread* queueThread = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -145,7 +145,10 @@ void SceneManager::Quit() {
|
||||
surfaceMgr = ServiceLocator<SurfaceManager>::Set(nullptr);
|
||||
netUtil = ServiceLocator<UDPNetworkUtility>::Set(nullptr);
|
||||
|
||||
//clean up the scene
|
||||
UnloadScene();
|
||||
|
||||
//deinitialize the APIs
|
||||
SDLNet_Quit();
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user