Skip to content

Network logging improvements #406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/GameNetwork/Transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "GameNetwork/udp.h"
#include "GameNetwork/NetworkDefs.h"

#define PRINT_IP_HELPER(ip) ((ip) >> 24) & 0xff, ((ip) >> 16) & 0xff, ((ip) >> 8 ) & 0xff, (ip) & 0xff

/**
* The transport layer handles the UDP socket for the game, and will packetize and
* de-packetize multiple ACK/CommandPacket/etc packets into larger aggregates.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ static void playerTooltip(GameWindow *window,
}
UnicodeString tooltip;
tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getName().str(), player->getLogin().str(), player->getHost().str());
#if defined(_DEBUG) || defined(_INTERNAL)
UnicodeString ip;
ip.format(L" - %d.%d.%d.%d", PRINT_IP_HELPER(player->getIP()));
tooltip.concat(ip);
#endif

TheMouse->setCursorTooltip( tooltip );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ static void playerTooltip(GameWindow *window,
}
UnicodeString tooltip;
tooltip.format(TheGameText->fetch("TOOLTIP:LANPlayer"), player->getName().str(), player->getLogin().str(), player->getHost().str());
#if defined(_DEBUG) || defined(_INTERNAL)
UnicodeString ip;
ip.format(L" - %d.%d.%d.%d", PRINT_IP_HELPER(player->getIP()));
tooltip.concat(ip);
#endif
TheMouse->setCursorTooltip( tooltip );
}

Expand Down Expand Up @@ -400,7 +405,7 @@ void LanLobbyMenuInit( WindowLayout *layout, void *userData )
// Choose an IP address, then initialize the LAN singleton
UnsignedInt IP = TheGlobalData->m_defaultIP;
IPEnumeration IPs;

const WideChar* IPSource;
if (!IP)
{
EnumeratedIP *IPlist = IPs.getAddresses();
Expand All @@ -416,23 +421,18 @@ void LanLobbyMenuInit( WindowLayout *layout, void *userData )
/// @todo: display error and exit lan lobby if no IPs are found
}

//UnicodeString str;
//str.format(L"Local IP chosen: %hs", IPlist->getIPstring().str());
//GadgetListBoxAddEntryText(listboxChatWindow, str, chatSystemColor, -1, 0);
IPSource = L"Local IP chosen";
IP = IPlist->getIP();
}
else
{
/*
UnicodeString str;
str.format(L"Default local IP: %d.%d.%d.%d",
(IP >> 24),
(IP >> 16) & 0xFF,
(IP >> 8) & 0xFF,
IP & 0xFF);
GadgetListBoxAddEntryText(listboxChatWindow, str, chatSystemColor, -1, 0);
*/
IPSource = L"Default local IP";
}
#if defined(_DEBUG) || defined(_INTERNAL)
UnicodeString str;
str.format(L"%s: %d.%d.%d.%d", IPSource, PRINT_IP_HELPER(IP));
GadgetListBoxAddEntryText(listboxChatWindow, str, chatSystemColor, -1, 0);
#endif

// TheLAN->init() sets us to be in a LAN menu screen automatically.
TheLAN->init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void HostDirectConnectGame()

UnsignedInt localIP = TheLAN->GetLocalIP();
UnicodeString localIPString;
localIPString.format(L"%d.%d.%d.%d", localIP >> 24, (localIP & 0xff0000) >> 16, (localIP & 0xff00) >> 8, localIP & 0xff);
localIPString.format(L"%d.%d.%d.%d", PRINT_IP_HELPER(localIP));

UnicodeString name;
name = GadgetTextEntryGetText(editPlayerName);
Expand Down Expand Up @@ -347,7 +347,7 @@ void NetworkDirectConnectInit( WindowLayout *layout, void *userData )
}

UnsignedInt ip = TheLAN->GetLocalIP();
ipstr.format(L"%d.%d.%d.%d", ip >> 24, (ip & 0xff0000) >> 16, (ip & 0xff00) >> 8, ip & 0xff);
ipstr.format(L"%d.%d.%d.%d", PRINT_IP_HELPER(ip));
GadgetStaticTextSetText(staticLocalIP, ipstr);

TheLAN->RequestLobbyLeave(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void OptionPreferences::setLANIPAddress( AsciiString IP )
void OptionPreferences::setLANIPAddress( UnsignedInt IP )
{
AsciiString tmp;
tmp.format("%d.%d.%d.%d", ((IP & 0xff000000) >> 24), ((IP & 0xff0000) >> 16), ((IP & 0xff00) >> 8), (IP & 0xff));
tmp.format("%d.%d.%d.%d", PRINT_IP_HELPER(IP));
(*this)["IPAddress"] = tmp;
}

Expand Down Expand Up @@ -315,7 +315,7 @@ void OptionPreferences::setOnlineIPAddress( AsciiString IP )
void OptionPreferences::setOnlineIPAddress( UnsignedInt IP )
{
AsciiString tmp;
tmp.format("%d.%d.%d.%d", ((IP & 0xff000000) >> 24), ((IP & 0xff0000) >> 16), ((IP & 0xff00) >> 8), (IP & 0xff));
tmp.format("%d.%d.%d.%d", PRINT_IP_HELPER(IP));
(*this)["GameSpyIPAddress"] = tmp;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1928,10 +1928,7 @@ void ConnectionManager::parseUserList(const GameInfo *game)
char *listPos;

DEBUG_LOG(("ConnectionManager::parseUserList - looking for local user at %d.%d.%d.%d:%d\n",
(m_localAddr >> 24) & 0xff,
(m_localAddr >> 16) & 0xff,
(m_localAddr >> 8) & 0xff,
m_localAddr & 0xff,
PRINT_IP_HELPER(m_localAddr),
m_localPort));

int numUsers = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,7 @@ Bool FirewallHelperClass::sendToManglerFromPort(UnsignedInt address, UnsignedSho
packet.length = sizeof(ManglerData);

DEBUG_LOG(("FirewallHelperClass::sendToManglerFromPort - Sending from port %d to %d.%d.%d.%d:%d\n", (UnsignedInt)port,
(address & 0xFF000000) >> 24,
(address & 0xFF0000) >> 16,
(address & 0xFF00) >> 8,
(address & 0xFF), MANGLER_PORT));
PRINT_IP_HELPER(address), MANGLER_PORT));
/*
DEBUG_LOG(("Buffer = "));
for (i = 0; i < sizeof(ManglerData); ++i) {
Expand Down
2 changes: 1 addition & 1 deletion GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ void GameInfo::setSlot( Int slotNum, GameSlot slotInfo )
#endif

DEBUG_LOG(("GameInfo::setSlot - setting slot %d to be player %ls with IP %d.%d.%d.%d\n", slotNum, slotInfo.getName().str(),
ip >> 24, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff));
PRINT_IP_HELPER(ip)));
}

GameSlot* GameInfo::getSlot( Int slotNum )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,7 @@ void GameSpyLaunchGame( void )
*/
{
user.format(",%s@%d.%d.%d.%d:%d", tmpUserName.str(),
((ip & 0xff000000) >> 24),
((ip & 0xff0000) >> 16),
((ip & 0xff00) >> 8),
((ip & 0xff)),
PRINT_IP_HELPER(ip),
TheNAT->getSlotPort(i)
);
}
Expand Down
20 changes: 10 additions & 10 deletions GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,43 +359,43 @@ void LANAPI::update( void )
{
// Location specification
case LANMessage::MSG_REQUEST_LOCATIONS: // Hey, where is everybody?
DEBUG_LOG(("LANAPI::update - got a MSG_REQUEST_LOCATIONS from 0x%08x\n", senderIP));
DEBUG_LOG(("LANAPI::update - got a MSG_REQUEST_LOCATIONS from %d.%d.%d.%d\n", PRINT_IP_HELPER(senderIP)));
handleRequestLocations( msg, senderIP );
break;
case LANMessage::MSG_GAME_ANNOUNCE: // Here someone is, and here's his game info!
DEBUG_LOG(("LANAPI::update - got a MSG_GAME_ANNOUNCE from 0x%08x\n", senderIP));
DEBUG_LOG(("LANAPI::update - got a MSG_GAME_ANNOUNCE from %d.%d.%d.%d\n", PRINT_IP_HELPER(senderIP)));
handleGameAnnounce( msg, senderIP );
break;
case LANMessage::MSG_LOBBY_ANNOUNCE: // Hey, I'm in the lobby!
DEBUG_LOG(("LANAPI::update - got a MSG_LOBBY_ANNOUNCE from 0x%08x\n", senderIP));
DEBUG_LOG(("LANAPI::update - got a MSG_LOBBY_ANNOUNCE from %d.%d.%d.%d\n", PRINT_IP_HELPER(senderIP)));
handleLobbyAnnounce( msg, senderIP );
break;
case LANMessage::MSG_REQUEST_GAME_INFO:
DEBUG_LOG(("LANAPI::update - got a MSG_REQUEST_GAME_INFO from 0x%08x\n", senderIP));
DEBUG_LOG(("LANAPI::update - got a MSG_REQUEST_GAME_INFO from %d.%d.%d.%d\n", PRINT_IP_HELPER(senderIP)));
handleRequestGameInfo( msg, senderIP );
break;

// Joining games
case LANMessage::MSG_REQUEST_JOIN: // Let me in! Let me in!
DEBUG_LOG(("LANAPI::update - got a MSG_REQUEST_JOIN from 0x%08x\n", senderIP));
DEBUG_LOG(("LANAPI::update - got a MSG_REQUEST_JOIN from %d.%d.%d.%d\n", PRINT_IP_HELPER(senderIP)));
handleRequestJoin( msg, senderIP );
break;
case LANMessage::MSG_JOIN_ACCEPT: // Okay, you can join.
DEBUG_LOG(("LANAPI::update - got a MSG_JOIN_ACCEPT from 0x%08x\n", senderIP));
DEBUG_LOG(("LANAPI::update - got a MSG_JOIN_ACCEPT from %d.%d.%d.%d\n", PRINT_IP_HELPER(senderIP)));
handleJoinAccept( msg, senderIP );
break;
case LANMessage::MSG_JOIN_DENY: // Go away! We don't want any!
DEBUG_LOG(("LANAPI::update - got a MSG_JOIN_DENY from 0x%08x\n", senderIP));
DEBUG_LOG(("LANAPI::update - got a MSG_JOIN_DENY from %d.%d.%d.%d\n", PRINT_IP_HELPER(senderIP)));
handleJoinDeny( msg, senderIP );
break;

// Leaving games, lobby
case LANMessage::MSG_REQUEST_GAME_LEAVE: // I'm outa here!
DEBUG_LOG(("LANAPI::update - got a MSG_REQUEST_GAME_LEAVE from 0x%08x\n", senderIP));
DEBUG_LOG(("LANAPI::update - got a MSG_REQUEST_GAME_LEAVE from %d.%d.%d.%d\n", PRINT_IP_HELPER(senderIP)));
handleRequestGameLeave( msg, senderIP );
break;
case LANMessage::MSG_REQUEST_LOBBY_LEAVE: // I'm outa here!
DEBUG_LOG(("LANAPI::update - got a MSG_REQUEST_LOBBY_LEAVE from 0x%08x\n", senderIP));
DEBUG_LOG(("LANAPI::update - got a MSG_REQUEST_LOBBY_LEAVE from %d.%d.%d.%d\n", PRINT_IP_HELPER(senderIP)));
handleRequestLobbyLeave( msg, senderIP );
break;

Expand All @@ -416,7 +416,7 @@ void LANAPI::update( void )
handleGameStartTimer( msg, senderIP );
break;
case LANMessage::MSG_GAME_OPTIONS: // Here's some info about the game.
DEBUG_LOG(("LANAPI::update - got a MSG_GAME_OPTIONS from 0x%08x\n", senderIP));
DEBUG_LOG(("LANAPI::update - got a MSG_GAME_OPTIONS from %d.%d.%d.%d\n", PRINT_IP_HELPER(senderIP)));
handleGameOptions( msg, senderIP );
break;
case LANMessage::MSG_INACTIVE: // someone is telling us that we're inactive.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ void LANAPI::handleJoinAccept( LANMessage *msg, UnsignedInt senderIP )

LANPreferences prefs;
AsciiString entry;
entry.format("%d.%d.%d.%d:%s", senderIP >> 24, (senderIP & 0xff0000) >> 16, (senderIP & 0xff00) >> 8, senderIP & 0xff, UnicodeStringToQuotedPrintable(m_currentGame->getSlot(0)->getName()).str());
entry.format("%d.%d.%d.%d:%s", PRINT_IP_HELPER(senderIP), UnicodeStringToQuotedPrintable(m_currentGame->getSlot(0)->getName()).str());
prefs["RemoteIP0"] = entry;
prefs.write();

Expand Down
30 changes: 15 additions & 15 deletions GeneralsMD/Code/GameEngine/Source/GameNetwork/NAT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ NATConnectionState NAT::connectionUpdate() {
if (slot != NULL) {
UnsignedInt ip = slot->getIP();
DEBUG_LOG(("NAT::connectionUpdate - sending keep alive to node %d at %d.%d.%d.%d:%d\n", node,
ip >> 24, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff, slot->getPort()));
PRINT_IP_HELPER(ip), slot->getPort()));
m_transport->queueSend(ip, slot->getPort(), (const unsigned char *)"KEEPALIVE", strlen("KEEPALIVE") + 1);
}
}
Expand All @@ -344,7 +344,7 @@ NATConnectionState NAT::connectionUpdate() {
UnsignedInt ip = m_transport->m_inBuffer[i].addr;
#endif
DEBUG_LOG(("NAT::connectionUpdate - got a packet from %d.%d.%d.%d:%d, length = %d\n",
ip >> 24, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff, m_transport->m_inBuffer[i].port, m_transport->m_inBuffer[i].length));
PRINT_IP_HELPER(ip), m_transport->m_inBuffer[i].port, m_transport->m_inBuffer[i].length));
UnsignedByte *data = m_transport->m_inBuffer[i].data;
if (memcmp(data, "PROBE", strlen("PROBE")) == 0) {
Int fromNode = atoi((char *)data + strlen("PROBE"));
Expand All @@ -360,8 +360,8 @@ NATConnectionState NAT::connectionUpdate() {
UnsignedInt slotIP = targetSlot->getIP();
#endif
DEBUG_LOG(("NAT::connectionUpdate - incomming packet has different from address than we expected, incoming: %d.%d.%d.%d expected: %d.%d.%d.%d\n",
fromIP >> 24, (fromIP >> 16) & 0xff, (fromIP >> 8) & 0xff, fromIP & 0xff,
slotIP >> 24, (slotIP >> 16) & 0xff, (slotIP >> 8) & 0xff, slotIP & 0xff));
PRINT_IP_HELPER(fromIP),
PRINT_IP_HELPER(slotIP)));
targetSlot->setIP(fromIP);
}
if (m_transport->m_inBuffer[i].port != targetSlot->getPort()) {
Expand All @@ -378,7 +378,7 @@ NATConnectionState NAT::connectionUpdate() {
if (memcmp(data, "KEEPALIVE", strlen("KEEPALIVE")) == 0) {
// keep alive packet, just toss it.
DEBUG_LOG(("NAT::connectionUpdate - got keepalive from %d.%d.%d.%d:%d\n",
ip >> 24, (ip >> 16) & 0xff, (ip >> 8) && 0xff, ip & 0xff, m_transport->m_inBuffer[i].port));
PRINT_IP_HELPER(ip), m_transport->m_inBuffer[i].port));
m_transport->m_inBuffer[i].length = 0;
}
}
Expand Down Expand Up @@ -435,7 +435,7 @@ NATConnectionState NAT::connectionUpdate() {
} else {
if (TheFirewallHelper != NULL) {
DEBUG_LOG(("NAT::connectionUpdate - trying to send to the mangler again. mangler address: %d.%d.%d.%d, from port: %d, packet ID:%d\n",
m_manglerAddress >> 24, (m_manglerAddress >> 16) & 0xff, (m_manglerAddress >> 8) & 0xff, m_manglerAddress & 0xff, m_spareSocketPort, m_packetID));
PRINT_IP_HELPER(m_manglerAddress), m_spareSocketPort, m_packetID));
TheFirewallHelper->sendToManglerFromPort(m_manglerAddress, m_spareSocketPort, m_packetID);
}
// m_manglerRetryTime = TheGameSpyConfig->getRetryInterval() + timeGetTime();
Expand Down Expand Up @@ -619,7 +619,7 @@ void NAT::attachSlotList(GameSlot *slotList[], Int localSlot, UnsignedInt localI
m_localIP = localIP;
m_transport = new Transport;
DEBUG_LOG(("NAT::attachSlotList - initting the transport socket with address %d.%d.%d.%d:%d\n",
m_localIP >> 24, (m_localIP >> 16) & 0xff, (m_localIP >> 8) & 0xff, m_localIP & 0xff, getSlotPort(localSlot)));
PRINT_IP_HELPER(m_localIP), getSlotPort(localSlot)));

m_startingPortNumber = NETWORK_BASE_PORT_NUMBER + ((timeGetTime() / 1000) % 20000);
DEBUG_LOG(("NAT::attachSlotList - using %d as the starting port number\n", m_startingPortNumber));
Expand Down Expand Up @@ -688,8 +688,8 @@ void NAT::doThisConnectionRound() {
#endif

DEBUG_LOG(("NAT::doThisConnectionRound - Target slot has IP %d.%d.%d.%d Local slot has IP %d.%d.%d.%d\n",
targetIP >> 24, (targetIP >> 16) & 0xff, (targetIP >> 8) & 0xff, targetIP & 0xff,
localIP >> 24, (localIP >> 16) & 0xff, (localIP >> 8) & 0xff, localIP & 0xff));
PRINT_IP_HELPER(targetIP),
PRINT_IP_HELPER(localIP)));

if (((targetSlot->getNATBehavior() & FirewallHelperClass::FIREWALL_TYPE_NETGEAR_BUG) == 0) &&
((localSlot->getNATBehavior() & FirewallHelperClass::FIREWALL_TYPE_NETGEAR_BUG) != 0)) {
Expand Down Expand Up @@ -725,7 +725,7 @@ void NAT::doThisConnectionRound() {

void NAT::sendAProbe(UnsignedInt ip, UnsignedShort port, Int fromNode) {
DEBUG_LOG(("NAT::sendAProbe - sending a probe from port %d to %d.%d.%d.%d:%d\n", getSlotPort(m_connectionNodes[m_localNodeNumber].m_slotIndex),
ip >> 24, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff, port));
PRINT_IP_HELPER(ip), port));
AsciiString str;
str.format("PROBE%d", fromNode);
m_transport->queueSend(ip, port, (unsigned char *)str.str(), str.getLength() + 1);
Expand Down Expand Up @@ -763,8 +763,8 @@ void NAT::sendMangledSourcePort() {
#endif
DEBUG_LOG(("NAT::sendMangledSourcePort - target and I are behind the same NAT, no mangling\n"));
DEBUG_LOG(("NAT::sendMangledSourcePort - I am %ls, target is %ls, my IP is %d.%d.%d.%d, target IP is %d.%d.%d.%d\n", localSlot->getName().str(), targetSlot->getName().str(),
localip >> 24, (localip >> 16) & 0xff, (localip >> 8) & 0xff, localip & 0xff,
targetip >> 24, (targetip >> 16) & 0xff, (targetip >> 8) & 0xff, targetip & 0xff));
PRINT_IP_HELPER(localip),
PRINT_IP_HELPER(targetip)));

sendMangledPortNumberToTarget(sourcePort, targetSlot);
m_sourcePorts[m_targetNodeNumber] = sourcePort;
Expand Down Expand Up @@ -826,7 +826,7 @@ void NAT::sendMangledSourcePort() {
memcpy(&m_manglerAddress, &(hostInfo->h_addr_list[0][0]), 4);
m_manglerAddress = ntohl(m_manglerAddress);
DEBUG_LOG(("NAT::sendMangledSourcePort - mangler %s address is %d.%d.%d.%d\n", manglerName,
m_manglerAddress >> 24, (m_manglerAddress >> 16) & 0xff, (m_manglerAddress >> 8) & 0xff, m_manglerAddress & 0xff));
PRINT_IP_HELPER(m_manglerAddress)));

DEBUG_LOG(("NAT::sendMangledSourcePort - NAT behavior = 0x%08x\n", fwType));

Expand Down Expand Up @@ -1038,7 +1038,7 @@ void NAT::gotMangledPort(Int nodeNumber, UnsignedShort mangledPort) {
UnsignedInt ip = targetSlot->getIP();
#endif
DEBUG_LOG(("NAT::gotMangledPort - don't have a netgear or we have already been probed, or both my target and I have a netgear, send a PROBE. Sending to %d.%d.%d.%d:%d\n",
ip >> 24, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff, targetSlot->getPort()));
PRINT_IP_HELPER(ip), targetSlot->getPort()));

sendAProbe(targetSlot->getIP(), targetSlot->getPort(), m_localNodeNumber);
notifyTargetOfProbe(targetSlot);
Expand Down Expand Up @@ -1269,7 +1269,7 @@ void NAT::processGlobalMessage(Int slotNum, const char *options) {
UnsignedShort port = (UnsignedShort)intport;

DEBUG_LOG(("NAT::processGlobalMessage - got port message from node %d, port: %d, internal address: %d.%d.%d.%d\n", node, port,
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff));
PRINT_IP_HELPER(addr)));

if ((node >= 0) && (node < m_numNodes)) {
if (port < 1024) {
Expand Down
20 changes: 12 additions & 8 deletions GeneralsMD/Code/GameEngine/Source/GameNetwork/Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,19 +225,20 @@ Bool Transport::doSend() {
if (m_outBuffer[i].length != 0)
{
int bytesSent = 0;
int bytesToSend = m_outBuffer[i].length + sizeof(TransportMessageHeader);
// Send this message
if ((bytesSent = m_udpsock->Write((unsigned char *)(&m_outBuffer[i]), m_outBuffer[i].length + sizeof(TransportMessageHeader), m_outBuffer[i].addr, m_outBuffer[i].port)) > 0)
if ((bytesSent = m_udpsock->Write((unsigned char *)(&m_outBuffer[i]), bytesToSend, m_outBuffer[i].addr, m_outBuffer[i].port)) > 0)
{
//DEBUG_LOG(("Sending %d bytes to %d:%d\n", m_outBuffer[i].length + sizeof(TransportMessageHeader), m_outBuffer[i].addr, m_outBuffer[i].port));
//DEBUG_LOG(("Sending %d bytes to %d.%d.%d.%d:%d\n", bytesToSend, PRINT_IP_HELPER(m_outBuffer[i].addr), m_outBuffer[i].port));
m_outgoingPackets[m_statisticsSlot]++;
m_outgoingBytes[m_statisticsSlot] += m_outBuffer[i].length + sizeof(TransportMessageHeader);
m_outBuffer[i].length = 0; // Remove from queue
// DEBUG_LOG(("Transport::doSend - sent %d butes to %d.%d.%d.%d:%d\n", bytesSent,
// (m_outBuffer[i].addr >> 24) & 0xff,
// (m_outBuffer[i].addr >> 16) & 0xff,
// (m_outBuffer[i].addr >> 8) & 0xff,
// m_outBuffer[i].addr & 0xff,
// m_outBuffer[i].port));
if (bytesSent != bytesToSend)
{
DEBUG_LOG(("Transport::doSend - wanted to send %d bytes, only sent %d bytes to %d.%d.%d.%d:%d\n",
bytesToSend, bytesSent,
PRINT_IP_HELPER(m_outBuffer[i].addr), m_outBuffer[i].port));
}
}
else
{
Expand Down Expand Up @@ -319,6 +320,7 @@ Bool Transport::doRecv()

if (len <= sizeof(TransportMessageHeader) || !isGeneralsPacket( &incomingMessage ))
{
DEBUG_LOG(("Transport::doRecv - unknownPacket! len = %d\n", len));
m_unknownPackets[m_statisticsSlot]++;
m_unknownBytes[m_statisticsSlot] += len;
continue;
Expand Down Expand Up @@ -384,6 +386,7 @@ Bool Transport::queueSend(UnsignedInt addr, UnsignedShort port, const UnsignedBy

if (len < 1 || len > MAX_PACKET_SIZE)
{
DEBUG_LOG(("Transport::queueSend: Invalid Packet size\n"));
return false;
}

Expand Down Expand Up @@ -413,6 +416,7 @@ Bool Transport::queueSend(UnsignedInt addr, UnsignedShort port, const UnsignedBy
return true;
}
}
DEBUG_LOG(("Send Queue is getting full, dropping packets\n"));
return false;
}

Expand Down