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:
Kayne Ruse
2013-06-17 10:00:07 +10:00
parent 009e7b845b
commit 3d92fb77b3
6 changed files with 134 additions and 66 deletions
+13 -3
View File
@@ -3,11 +3,15 @@
#include "defines.hpp"
#include "packet_type.hpp"
#include "service_locator.hpp"
#include "network_queue.hpp"
#include "config_Utility.hpp"
#include "udp_network_utility.hpp"
#include "vector2.hpp"
#include "SDL/SDL_thread.h"
#include <map>
#include <chrono>
@@ -39,20 +43,26 @@ public:
ServerApplication(ServerApplication const&) = delete;
private:
//game loop
void HandleNetwork();
void UpdateWorld(double delta);
//network loop
int HandlePacket(Packet p);
void Broadcast(BroadcastRequest&);
//services
ConfigUtility* configUtil = nullptr;
UDPNetworkUtility* netUtil = nullptr;
//members
Clock::time_point lastTick = Clock::now();
std::map<int, ClientData> clients;
std::map<int, PlayerData> players;
ConfigUtility configUtil;
UDPNetworkUtility netUtil;
bool running = false;
//threads
SDL_Thread* queueThread = nullptr;
};
#endif