summaryrefslogtreecommitdiff
path: root/src/network/core/udp.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-04-03 00:33:00 +0000
committerrubidium <rubidium@openttd.org>2009-04-03 00:33:00 +0000
commitba5aafb9bba4887b502dba32e56747fe10af604e (patch)
treeaed246d3f133b865c118d25907878c21f972bbf4 /src/network/core/udp.cpp
parentc7b6469dabe5018775d075bee0a5293175024b42 (diff)
downloadopenttd-ba5aafb9bba4887b502dba32e56747fe10af604e.tar.xz
(svn r15921) -Fix: some OSes don't like sizeof(sockaddr_storage) but want sizeof(sockaddr) or whatever is 'valid' for the given protocol
Diffstat (limited to 'src/network/core/udp.cpp')
-rw-r--r--src/network/core/udp.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp
index 110cec2f2..4818767d9 100644
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -89,7 +89,7 @@ void NetworkUDPSocketHandler::SendPacket(Packet *p, NetworkAddress *recv)
p->PrepareToSend();
/* Send the buffer */
- res = sendto(this->sock, (const char*)p->buffer, p->size, 0, (struct sockaddr *)recv->GetAddress(), sizeof(*recv->GetAddress()));
+ res = sendto(this->sock, (const char*)p->buffer, p->size, 0, (struct sockaddr *)recv->GetAddress(), recv->GetAddressLength());
/* Check for any errors, but ignore it otherwise */
if (res == -1) DEBUG(net, 1, "[udp] sendto failed with: %i", GET_LAST_ERROR());
@@ -119,7 +119,7 @@ void NetworkUDPSocketHandler::ReceivePackets()
/* We got some bytes for the base header of the packet. */
if (nbytes > 2) {
- NetworkAddress address(client_addr);
+ NetworkAddress address(client_addr, client_len);
p.PrepareToRead();
/* If the size does not match the packet must be corrupted.