diff --git a/include/Client.h b/include/Client.h index 8f3febc..385d2ec 100644 --- a/include/Client.h +++ b/include/Client.h @@ -83,7 +83,7 @@ private: std::mutex mVehicleDataMutex; TSetOfVehicleData mVehicleData; std::string mName = "Unknown Client"; - SOCKET mSocket[2] { SOCKET(-1) }; + SOCKET mSocket[2] { SOCKET(0), SOCKET(0) }; sockaddr_in mUDPAddress {}; // is this initialization OK? yes it is int mUnicycleID = -1; std::string mRole; diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index bd7d00e..82cf445 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -484,7 +484,12 @@ void TNetwork::ClientKick(TClient& c, const std::string& R) { // TODO handle } c.SetStatus(-2); - CloseSocketProper(c.GetTCPSock()); + + if (c.GetTCPSock()) + CloseSocketProper(c.GetTCPSock()); + + if (c.GetDownSock()) + CloseSocketProper(c.GetDownSock()); } void TNetwork::Looper(const std::weak_ptr& c) { while (!c.expired()) {