diff --git a/bfs/include/DataSyncThread.hpp b/bfs/include/DataSyncThread.hpp index d557f5f..09a3ceb 100644 --- a/bfs/include/DataSyncThread.hpp +++ b/bfs/include/DataSyncThread.hpp @@ -40,7 +40,7 @@ class DataSyncThread // if this one is still running bool threadRunning = false; - std::vector incomingAttributes; + vector incomingAttributes; HANDLE attribMutex; public: DataSyncThread(SOCKET s) diff --git a/bfs/scripts/log.txt b/bfs/scripts/log.txt index 3f83778..408b766 100644 --- a/bfs/scripts/log.txt +++ b/bfs/scripts/log.txt @@ -230,3 +230,108 @@ Listening for clients... Hello new client! Listening for clients... Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... +Hello new client! +Listening for clients... diff --git a/bfs/src/comms/AlgorithmServer.cpp b/bfs/src/comms/AlgorithmServer.cpp index e6fb659..3521eb4 100644 --- a/bfs/src/comms/AlgorithmServer.cpp +++ b/bfs/src/comms/AlgorithmServer.cpp @@ -80,10 +80,10 @@ void AlgorithmServer::serverThreadRuntime() while (continueThread) { write_log("Listening for clients...\n", 1, logger->filename, logger); - printf("Listening for clients...\n"); + fprintf(stderr, "Listening for clients...\n"); ClientSocket = accept(ListenSocket, NULL, NULL); write_log("Hello new client!\n", 1, logger->filename, logger); - printf("Hello new client!\n"); + fprintf(stderr, "Hello new client!\n"); if (ClientSocket == INVALID_SOCKET) { write_log("accept failed with error: ", 1, logger->filename, logger); write_log(std::to_string(WSAGetLastError()), 1, logger->filename, logger); @@ -100,15 +100,17 @@ void AlgorithmServer::serverThreadRuntime() // Reaping any old data sync threads if (lockClientThreadsMutex() == STATUS_WAIT_0) { - auto it = clientThreads.begin(); - while (clientThreads.size() > 0 && it != clientThreads.end()) + for (vector::iterator x = clientThreads.begin(); x != clientThreads.end();) { - if (!(**it).isClientConnected()) + //Check for projectiles whos status is dead. + if (!(*x)->isRunning()) { - clientThreads.erase(it); + delete (*x); + x = clientThreads.erase(x); } - else { - ++it; + else + { + ++x; } }