fix conversion of port numbers
This commit is contained in:
parent
c3dae4bfee
commit
c1b4bdb17d
3 changed files with 7 additions and 8 deletions
|
@ -573,13 +573,15 @@ int UpdateParser(void)
|
|||
// even for clients inside the same NAT. This will also not work if in
|
||||
// that case the NAT does not support hairpin translation. But we'll see
|
||||
// how common that is...
|
||||
char *ip = NULL;
|
||||
char *port = NULL;
|
||||
Parse1or2Args(UDPBuffer, &ip, &port);
|
||||
char ip[16] = {'\0'};
|
||||
char port[6] = {'\0'};
|
||||
sscanf(UDPBuffer, "%s %s", (char*)&ip, (char*)&port);
|
||||
DebugPrint("Filling in UDP info for %s:%s\n" _C_ ip _C_ port);
|
||||
if (FillinUDPInfo(UDPHost, UDPPort, ip, port)) {
|
||||
fprintf(stderr, "Error filling in UDP info for %s:%s with %d.%d.%d.%d:%d",
|
||||
ip, port, NIPQUAD(ntohl(UDPHost)), UDPPort);
|
||||
}
|
||||
UDPBuffer[0] = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -268,10 +268,8 @@ static void AcceptConnections()
|
|||
}
|
||||
if (NetSocketReady(HolePunchSocket, 0)) {
|
||||
NetRecvUDP(HolePunchSocket, UDPBuffer, sizeof(UDPBuffer), &UDPHost, &UDPPort);
|
||||
} else {
|
||||
UDPBuffer[0] = '\0';
|
||||
UDPHost = 0;
|
||||
UDPPort = 0;
|
||||
UDPPort = ntohs(UDPPort);
|
||||
DebugPrint("New UDP %s (%d %d)\n" _C_ UDPBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,6 @@ int CMetaClient::CreateGame(std::string desc, std::string map, std::string playe
|
|||
return -1;
|
||||
}
|
||||
CHost metaServerHost(metaHost.c_str(), ntohs(metaPort));
|
||||
printf("PORTIN: %d PORTOUT: %d\n", metaPort, metaServerHost.getPort());
|
||||
|
||||
std::string ipport(CNetworkParameter::Instance.localHost.c_str());
|
||||
ipport += " ";
|
||||
|
|
Loading…
Reference in a new issue