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