mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r15918) -Fix (r15917): comparing IPs sometimes failed due to 'random' data (as spotted by SpComb)
This commit is contained in:
parent
c5160c7c8e
commit
beef5da970
|
@ -101,6 +101,8 @@ void NetworkUDPSocketHandler::SendPacket(Packet *p, NetworkAddress *recv)
|
|||
void NetworkUDPSocketHandler::ReceivePackets()
|
||||
{
|
||||
struct sockaddr_storage client_addr;
|
||||
memset(&client_addr, 0, sizeof(client_addr));
|
||||
|
||||
socklen_t client_len;
|
||||
int nbytes;
|
||||
Packet p(this);
|
||||
|
|
|
@ -480,6 +480,7 @@ static void NetworkAcceptClients()
|
|||
assert(_listensocket != INVALID_SOCKET);
|
||||
|
||||
for (;;) {
|
||||
memset(&sin, 0, sizeof(sin));
|
||||
socklen_t sin_len = sizeof(sin);
|
||||
SOCKET s = accept(_listensocket, (struct sockaddr*)&sin, &sin_len);
|
||||
if (s == INVALID_SOCKET) return;
|
||||
|
|
Loading…
Reference in New Issue