From e01a718ac6240e9e58a3e49012727b06052dd3ad Mon Sep 17 00:00:00 2001 From: mdiluzio Date: Fri, 2 Jan 2015 18:57:47 +0000 Subject: [PATCH] Fix bug where we passed client info to the thread by ref, like an ape --- source/client/client.cpp | 17 ++++++++++------- source/client/server.cpp | 10 +++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/source/client/client.cpp b/source/client/client.cpp index 9401df2..241c002 100644 --- a/source/client/client.cpp +++ b/source/client/client.cpp @@ -39,13 +39,15 @@ int runClient(int argc, char* argv[]) portno = TTRTS_PORT; // Create a new socket - // AF_INET is general internetsocked domain + // AF_INET is general internetsocket domain // SOCK_STREAM as messages will be read in on this socket, SOCK_DGRAM would be for packets // 0 is for default protocol sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) error("ERROR opening socket"); + std::cout<<"Opened socket on "< clientThreads; for(auto client : myClients) { - std::thread clientThread(waitForOrdersFromClient,std::ref(client), std::ref(gameMutex), std::ref(game)); + std::thread clientThread(waitForOrdersFromClient, client, std::ref(gameMutex), std::ref(game)); clientThreads.push_back(std::move(clientThread)); } @@ -166,6 +169,7 @@ int runServer(int argc, char* argv[]) thread.join(); } + std::cout<<"Orders recieved, simulating turn"<