Overhaul to console structure, a bit
This commit is contained in:
+42
-42
@@ -83,7 +83,7 @@ static void NET_Ban_f(void) {
|
||||
command::forward_to_server();
|
||||
return;
|
||||
}
|
||||
print_fn = Con_Printf;
|
||||
print_fn = console::info;
|
||||
} else {
|
||||
if (pr_global_struct->deathmatch)
|
||||
return;
|
||||
@@ -283,14 +283,14 @@ int Datagram_GetMessage(qsocket_t *sock) {
|
||||
break;
|
||||
|
||||
if (length == (unsigned int) -1) {
|
||||
Con_Printf("Read error\n");
|
||||
console::info("Read error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sfunc.AddrCompare(&readaddr, &sock->addr) != 0) {
|
||||
Con_Printf("Forged packet received\n");
|
||||
Con_Printf("Expected: %s\n", StrAddr(&sock->addr));
|
||||
Con_Printf("Received: %s\n", StrAddr(&readaddr));
|
||||
console::info("Forged packet received\n");
|
||||
console::info("Expected: %s\n", StrAddr(&sock->addr));
|
||||
console::info("Received: %s\n", StrAddr(&readaddr));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -311,14 +311,14 @@ int Datagram_GetMessage(qsocket_t *sock) {
|
||||
|
||||
if (flags & NETFLAG_UNRELIABLE) {
|
||||
if (sequence < sock->unreliableReceiveSequence) {
|
||||
Con_DPrintf("Got a stale datagram\n");
|
||||
console::debug("Got a stale datagram\n");
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
if (sequence != sock->unreliableReceiveSequence) {
|
||||
count = sequence - sock->unreliableReceiveSequence;
|
||||
droppedDatagrams += count;
|
||||
Con_DPrintf("Dropped %u datagram(s)\n", count);
|
||||
console::debug("Dropped %u datagram(s)\n", count);
|
||||
}
|
||||
sock->unreliableReceiveSequence = sequence + 1;
|
||||
|
||||
@@ -333,15 +333,15 @@ int Datagram_GetMessage(qsocket_t *sock) {
|
||||
|
||||
if (flags & NETFLAG_ACK) {
|
||||
if (sequence != (sock->sendSequence - 1)) {
|
||||
Con_DPrintf("Stale ACK received\n");
|
||||
console::debug("Stale ACK received\n");
|
||||
continue;
|
||||
}
|
||||
if (sequence == sock->ackSequence) {
|
||||
sock->ackSequence++;
|
||||
if (sock->ackSequence != sock->sendSequence)
|
||||
Con_DPrintf("ack sequencing error\n");
|
||||
console::debug("ack sequencing error\n");
|
||||
} else {
|
||||
Con_DPrintf("Duplicate ACK received\n");
|
||||
console::debug("Duplicate ACK received\n");
|
||||
continue;
|
||||
}
|
||||
sock->sendMessageLength -= MAX_DATAGRAM;
|
||||
@@ -392,26 +392,26 @@ int Datagram_GetMessage(qsocket_t *sock) {
|
||||
|
||||
|
||||
static void PrintStats(qsocket_t *s) {
|
||||
Con_Printf("canSend = %4u \n", s->canSend);
|
||||
Con_Printf("sendSeq = %4u ", s->sendSequence);
|
||||
Con_Printf("recvSeq = %4u \n", s->receiveSequence);
|
||||
Con_Printf("\n");
|
||||
console::info("canSend = %4u \n", s->canSend);
|
||||
console::info("sendSeq = %4u ", s->sendSequence);
|
||||
console::info("recvSeq = %4u \n", s->receiveSequence);
|
||||
console::info("\n");
|
||||
}
|
||||
|
||||
static void NET_Stats_f(void) {
|
||||
qsocket_t *s;
|
||||
|
||||
if (command::argc() == 1) {
|
||||
Con_Printf("unreliable messages sent = %i\n", unreliableMessagesSent);
|
||||
Con_Printf("unreliable messages recv = %i\n", unreliableMessagesReceived);
|
||||
Con_Printf("reliable messages sent = %i\n", messagesSent);
|
||||
Con_Printf("reliable messages received = %i\n", messagesReceived);
|
||||
Con_Printf("packetsSent = %i\n", packetsSent);
|
||||
Con_Printf("packetsReSent = %i\n", packetsReSent);
|
||||
Con_Printf("packetsReceived = %i\n", packetsReceived);
|
||||
Con_Printf("receivedDuplicateCount = %i\n", receivedDuplicateCount);
|
||||
Con_Printf("shortPacketCount = %i\n", shortPacketCount);
|
||||
Con_Printf("droppedDatagrams = %i\n", droppedDatagrams);
|
||||
console::info("unreliable messages sent = %i\n", unreliableMessagesSent);
|
||||
console::info("unreliable messages recv = %i\n", unreliableMessagesReceived);
|
||||
console::info("reliable messages sent = %i\n", messagesSent);
|
||||
console::info("reliable messages received = %i\n", messagesReceived);
|
||||
console::info("packetsSent = %i\n", packetsSent);
|
||||
console::info("packetsReSent = %i\n", packetsReSent);
|
||||
console::info("packetsReceived = %i\n", packetsReceived);
|
||||
console::info("receivedDuplicateCount = %i\n", receivedDuplicateCount);
|
||||
console::info("shortPacketCount = %i\n", shortPacketCount);
|
||||
console::info("droppedDatagrams = %i\n", droppedDatagrams);
|
||||
} else if (std::strcmp(command::argv(1)->c_str(), "*") == 0) {
|
||||
for (s = net_activeSockets; s; s = s->next)
|
||||
PrintStats(s);
|
||||
@@ -454,7 +454,7 @@ static const char *Strip_Port(const char *host) {
|
||||
port = std::atoi(p);
|
||||
if (port > 0 && port < 65536 && port != net_hostport) {
|
||||
net_hostport = port;
|
||||
Con_Printf("Port set to %d\n", net_hostport);
|
||||
console::info("Port set to %d\n", net_hostport);
|
||||
}
|
||||
return noport;
|
||||
}
|
||||
@@ -508,7 +508,7 @@ static void Test_Poll(void *unused) {
|
||||
connectTime = MSG_ReadLong();
|
||||
std::strcpy(address, MSG_ReadString());
|
||||
|
||||
Con_Printf("%s\n frags:%3i colors:%d %d time:%d\n %s\n", name, frags, colors >> 4, colors & 0x0f,
|
||||
console::info("%s\n frags:%3i colors:%d %d time:%d\n %s\n", name, frags, colors >> 4, colors & 0x0f,
|
||||
connectTime / 60, address);
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ static void Test_f(void) {
|
||||
}
|
||||
|
||||
if (net_landriverlevel == net_numlandrivers) {
|
||||
Con_Printf("Could not resolve %s\n", host);
|
||||
console::info("Could not resolve %s\n", host);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -627,7 +627,7 @@ static void Test2_Poll(void *unused) {
|
||||
goto Done;
|
||||
std::strcpy(value, MSG_ReadString());
|
||||
|
||||
Con_Printf("%-16.16s %-16.16s\n", name, value);
|
||||
console::info("%-16.16s %-16.16s\n", name, value);
|
||||
|
||||
SZ_Clear(&net_message);
|
||||
// save space for the header, filled in later
|
||||
@@ -643,7 +643,7 @@ Reschedule:
|
||||
return;
|
||||
|
||||
Error:
|
||||
Con_Printf("Unexpected response to Rule Info request\n");
|
||||
console::info("Unexpected response to Rule Info request\n");
|
||||
Done:
|
||||
dfunc.Close_Socket(test2Socket);
|
||||
test2InProgress = false;
|
||||
@@ -685,7 +685,7 @@ static void Test2_f(void) {
|
||||
}
|
||||
|
||||
if (net_landriverlevel == net_numlandrivers) {
|
||||
Con_Printf("Could not resolve %s\n", host);
|
||||
console::info("Could not resolve %s\n", host);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1135,7 +1135,7 @@ static qsocket_t *_Datagram_Connect(const char *host) {
|
||||
|
||||
// see if we can resolve the host name
|
||||
if (dfunc.GetAddrFromName(host, &sendaddr) == -1) {
|
||||
Con_Printf("Could not resolve %s\n", host);
|
||||
console::info("Could not resolve %s\n", host);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1154,7 +1154,7 @@ static qsocket_t *_Datagram_Connect(const char *host) {
|
||||
goto ErrorReturn;
|
||||
|
||||
// send the connection request
|
||||
Con_Printf("trying...\n");
|
||||
console::info("trying...\n");
|
||||
SCR_UpdateScreen();
|
||||
start_time = net_time;
|
||||
|
||||
@@ -1174,9 +1174,9 @@ static qsocket_t *_Datagram_Connect(const char *host) {
|
||||
if (ret > 0) {
|
||||
// is it from the right place?
|
||||
if (sfunc.AddrCompare(&readaddr, &sendaddr) != 0) {
|
||||
Con_Printf("wrong reply address\n");
|
||||
Con_Printf("Expected: %s | %s\n", dfunc.AddrToString(&sendaddr), StrAddr(&sendaddr));
|
||||
Con_Printf("Received: %s | %s\n", dfunc.AddrToString(&readaddr), StrAddr(&readaddr));
|
||||
console::info("wrong reply address\n");
|
||||
console::info("Expected: %s | %s\n", dfunc.AddrToString(&sendaddr), StrAddr(&sendaddr));
|
||||
console::info("Received: %s | %s\n", dfunc.AddrToString(&readaddr), StrAddr(&readaddr));
|
||||
SCR_UpdateScreen();
|
||||
ret = 0;
|
||||
continue;
|
||||
@@ -1210,21 +1210,21 @@ static qsocket_t *_Datagram_Connect(const char *host) {
|
||||
if (ret)
|
||||
break;
|
||||
|
||||
Con_Printf("still trying...\n");
|
||||
console::info("still trying...\n");
|
||||
SCR_UpdateScreen();
|
||||
start_time = SetNetTime();
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
reason = "No Response";
|
||||
Con_Printf("%s\n", reason);
|
||||
console::info("%s\n", reason);
|
||||
std::strcpy(m_return_reason, reason);
|
||||
goto ErrorReturn;
|
||||
}
|
||||
|
||||
if (ret == -1) {
|
||||
reason = "Network Error";
|
||||
Con_Printf("%s\n", reason);
|
||||
console::info("%s\n", reason);
|
||||
std::strcpy(m_return_reason, reason);
|
||||
goto ErrorReturn;
|
||||
}
|
||||
@@ -1232,7 +1232,7 @@ static qsocket_t *_Datagram_Connect(const char *host) {
|
||||
ret = MSG_ReadByte();
|
||||
if (ret == CCREP_REJECT) {
|
||||
reason = MSG_ReadString();
|
||||
Con_Printf("%s\n", reason);
|
||||
console::info("%s\n", reason);
|
||||
q_strlcpy(m_return_reason, reason, sizeof(m_return_reason));
|
||||
goto ErrorReturn;
|
||||
}
|
||||
@@ -1242,20 +1242,20 @@ static qsocket_t *_Datagram_Connect(const char *host) {
|
||||
dfunc.SetSocketPort(&sock->addr, MSG_ReadLong());
|
||||
} else {
|
||||
reason = "Bad Response";
|
||||
Con_Printf("%s\n", reason);
|
||||
console::info("%s\n", reason);
|
||||
std::strcpy(m_return_reason, reason);
|
||||
goto ErrorReturn;
|
||||
}
|
||||
|
||||
dfunc.GetNameFromAddr(&sendaddr, sock->address);
|
||||
|
||||
Con_Printf("Connection accepted\n");
|
||||
console::info("Connection accepted\n");
|
||||
sock->lastMessageTime = SetNetTime();
|
||||
|
||||
// switch the connection to the specified address
|
||||
if (dfunc.Connect(newsock, &sock->addr) == -1) {
|
||||
reason = "Connect to Game failed";
|
||||
Con_Printf("%s\n", reason);
|
||||
console::info("%s\n", reason);
|
||||
std::strcpy(m_return_reason, reason);
|
||||
goto ErrorReturn;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user