summaryrefslogtreecommitdiff
path: root/src/network/network_client.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-05-12 16:34:02 +0200
committerGitHub <noreply@github.com>2021-05-12 16:34:02 +0200
commitb136e65cf9375700e77579b344f8dd86a5a61336 (patch)
tree829083df6b7c2f86a2e70eba91bc5e88230a8586 /src/network/network_client.cpp
parent56050fc96f59cef171d3b8a03ae3f3c9b83f9426 (diff)
downloadopenttd-b136e65cf9375700e77579b344f8dd86a5a61336.tar.xz
Change: reworked the debug levels for network facility (#9251)
It now follows very simple rules: 0 - Fatal, user should know about this 1 - Error, but we are recovering 2 - Warning, wrong but okay if you don't know 3 - Info, information you might care about 4 - 5 - Debug #1 - High level debug messages 6 - Debug #2 - Low level debug messages 7 - Trace information
Diffstat (limited to 'src/network/network_client.cpp')
-rw-r--r--src/network/network_client.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 501449705..34746e935 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -136,7 +136,7 @@ void ClientNetworkEmergencySave()
if (!_networking) return;
const char *filename = "netsave.sav";
- DEBUG(net, 0, "Client: Performing emergency save (%s)", filename);
+ DEBUG(net, 3, "Performing emergency save: %s", filename);
SaveOrLoad(filename, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, false);
}
@@ -172,7 +172,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::CloseConnection(NetworkRecvSta
*/
if (this->sock == INVALID_SOCKET) return status;
- DEBUG(net, 1, "Closed client connection %d", this->client_id);
+ DEBUG(net, 3, "Closed client connection %d", this->client_id);
this->SendPackets(true);
@@ -286,7 +286,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
#endif
ShowNetworkError(STR_NETWORK_ERROR_DESYNC);
DEBUG(desync, 1, "sync_err: %08x; %02x", _date, _date_fract);
- DEBUG(net, 0, "Sync error detected!");
+ DEBUG(net, 0, "Sync error detected");
my_client->ClientError(NETWORK_RECV_STATUS_DESYNC);
return false;
}
@@ -301,7 +301,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
_sync_frame = 0;
} else if (_sync_frame < _frame_counter) {
- DEBUG(net, 1, "Missed frame for sync-test (%d / %d)", _sync_frame, _frame_counter);
+ DEBUG(net, 1, "Missed frame for sync-test: %d / %d", _sync_frame, _frame_counter);
_sync_frame = 0;
}
}
@@ -978,13 +978,13 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FRAME(Packet *p
/* Receive the token. */
if (p->CanReadFromPacket(sizeof(uint8))) this->token = p->Recv_uint8();
- DEBUG(net, 5, "Received FRAME %d", _frame_counter_server);
+ DEBUG(net, 7, "Received FRAME %d", _frame_counter_server);
/* Let the server know that we received this frame correctly
* We do this only once per day, to save some bandwidth ;) */
if (!_network_first_time && last_ack_frame < _frame_counter) {
last_ack_frame = _frame_counter + DAY_TICKS;
- DEBUG(net, 4, "Sent ACK at %d", _frame_counter);
+ DEBUG(net, 7, "Sent ACK at %d", _frame_counter);
SendAck();
}
@@ -1100,7 +1100,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_QUIT(Packet *p)
NetworkTextMessage(NETWORK_ACTION_LEAVE, CC_DEFAULT, false, ci->client_name, nullptr, STR_NETWORK_MESSAGE_CLIENT_LEAVING);
delete ci;
} else {
- DEBUG(net, 0, "Unknown client (%d) is leaving the game", client_id);
+ DEBUG(net, 1, "Unknown client (%d) is leaving the game", client_id);
}
InvalidateWindowData(WC_CLIENT_LIST, 0);
@@ -1180,7 +1180,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MOVE(Packet *p)
if (client_id == 0) {
/* definitely an invalid client id, debug message and do nothing. */
- DEBUG(net, 0, "[move] received invalid client index = 0");
+ DEBUG(net, 1, "Received invalid client index = 0");
return NETWORK_RECV_STATUS_MALFORMED_PACKET;
}