From fe3e52b80a03aad89298c954d105e4dcf916bb5d Mon Sep 17 00:00:00 2001 From: Meep-Eep Date: Thu, 1 Feb 2007 22:00:22 +0000 Subject: [PATCH] More netplay debugging code git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2694 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/netplay/netrcv.c | 9 ++++++++- sc2/src/sc2code/netplay/netsend.c | 9 ++++++++- sc2/src/sc2code/netplay/packetq.c | 10 +++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/sc2/src/sc2code/netplay/netrcv.c b/sc2/src/sc2code/netplay/netrcv.c index c05331d99..137cfcd88 100644 --- a/sc2/src/sc2code/netplay/netrcv.c +++ b/sc2/src/sc2code/netplay/netrcv.c @@ -82,7 +82,14 @@ dataReceivedSingle(NetConnection *conn, const uint8 *data, log_add(log_Debug, "NETPLAY: [%d] <== Received packet of type %s.\n", NetConnection_getPlayerNr(conn), packetTypeData[type].name); } -#endif +#ifdef NETPLAY_DEBUG_FILE + if (conn->debugFile != NULL) { + uio_fprintf(conn->debugFile, + "NETPLAY: [%d] <== Received packet of type %s.\n", + NetConnection_getPlayerNr(conn), packetTypeData[type].name); + } +#endif /* NETPLAY_DEBUG_FILE */ +#endif /* NETPLAY_DEBUG */ result = packetTypeData[type].handler(conn, data); if (result == -1) { diff --git a/sc2/src/sc2code/netplay/netsend.c b/sc2/src/sc2code/netplay/netsend.c index 0d47c8d9f..e24a87cc0 100644 --- a/sc2/src/sc2code/netplay/netsend.c +++ b/sc2/src/sc2code/netplay/netsend.c @@ -47,7 +47,14 @@ sendPacket(NetConnection *conn, Packet *packet) { // log_add(log_Debug, "NETPLAY: [%d] ==> Sending packet of type %s.\n", // conn->player, packetTypeData[packetType(packet)].name); //} -#endif +#ifdef NETPLAY_DEBUG_FILE + if (conn->debugFile != NULL) { + uio_fprintf(conn->debugFile, + "NETPLAY: [%d] ==> Sending packet of type %s.\n", + conn->player, packetTypeData[packetType(packet)].name); + } +#endif /* NETPLAY_DEBUG_FILE */ +#endif /* NETPLAY_DEBUG */ socket = NetDescriptor_getSocket(conn->nd); diff --git a/sc2/src/sc2code/netplay/packetq.c b/sc2/src/sc2code/netplay/packetq.c index 9997f7ee5..6c4e87354 100644 --- a/sc2/src/sc2code/netplay/packetq.c +++ b/sc2/src/sc2code/netplay/packetq.c @@ -102,7 +102,15 @@ queuePacket(NetConnection *conn, Packet *packet, bool urgent) { NetConnection_getPlayerNr(conn), packetTypeData[packetType(packet)].name); } -#endif +#ifdef NETPLAY_DEBUG_FILE + if (conn->debugFile != NULL) { + uio_fprintf(conn->debugFile, + "NETPLAY: [%d] ==> Queueing packet of type %s.\n", + NetConnection_getPlayerNr(conn), + packetTypeData[packetType(packet)].name); + } +#endif /* NETPLAY_DEBUG_FILE */ +#endif /* NETPLAY_DEBUG */ } // If an error occurs during sending, we leave the unsent packets in