Index: ps/trunk/source/network/NetSession.h =================================================================== --- ps/trunk/source/network/NetSession.h +++ ps/trunk/source/network/NetSession.h @@ -126,6 +126,9 @@ // Net messages to send on the next flush() call. boost::lockfree::queue m_OutgoingMessages; + // Last know state. If false, flushing errors are silenced. + bool m_Connected = false; + // Wrapper around enet stats - those are atomic as the code is lock-free. std::atomic m_LastReceivedTime; std::atomic m_MeanRTT; Index: ps/trunk/source/network/NetSession.cpp =================================================================== --- ps/trunk/source/network/NetSession.cpp +++ ps/trunk/source/network/NetSession.cpp @@ -139,6 +139,7 @@ char hostname[256] = "(error)"; enet_address_get_host_ip(&event.peer->address, hostname, ARRAY_SIZE(hostname)); LOGMESSAGE("Net client: Connected to %s:%u", hostname, (unsigned int)event.peer->address.port); + m_Connected = true; m_IncomingMessages.push(event); } @@ -148,6 +149,7 @@ // Report immediately. LOGMESSAGE("Net client: Disconnected"); + m_Connected = false; m_IncomingMessages.push(event); } @@ -160,7 +162,13 @@ ENetPacket* packet; while (m_OutgoingMessages.pop(packet)) if (enet_peer_send(m_Server, CNetHost::DEFAULT_CHANNEL, packet) < 0) - LOGERROR("NetClient: Failed to send packet to server"); + { + // Report the error, but do so silently if we know we are disconnected. + if (m_Connected) + LOGERROR("NetClient: Failed to send packet to server"); + else + LOGMESSAGE("NetClient: Failed to send packet to server"); + } enet_host_flush(m_Host); }