summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-01-06 22:58:01 +0000
committerrubidium <rubidium@openttd.org>2007-01-06 22:58:01 +0000
commit8d41fe225e36b5172c43521ec03e7fce21b1a4c4 (patch)
treea542fc7075e2d49b935217cfc3c2d1dccf7e4f2c /src/network
parenta05ab3028ad81f3144ff289fcf5a5dd31cbd41fd (diff)
downloadopenttd-8d41fe225e36b5172c43521ec03e7fce21b1a4c4.tar.xz
(svn r7931) -Fix (r7759): multiple (different) -O flags made compilations with the wrong optimisations.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/core/config.h2
-rw-r--r--src/network/core/udp.c12
-rw-r--r--src/network/network_udp.c2
3 files changed, 12 insertions, 4 deletions
diff --git a/src/network/core/config.h b/src/network/core/config.h
index 0b80800f0..bc1cb6304 100644
--- a/src/network/core/config.h
+++ b/src/network/core/config.h
@@ -6,7 +6,7 @@
#ifdef ENABLE_NETWORK
/** DNS hostname of the masterserver */
-#define NETWORK_MASTER_SERVER_HOST "master.openttd.org"
+#define NETWORK_MASTER_SERVER_HOST "localhost"
/** Message sent to the masterserver to 'identify' this client as OpenTTD */
#define NETWORK_MASTER_SERVER_WELCOME_MESSAGE "OpenTTDRegister"
diff --git a/src/network/core/udp.c b/src/network/core/udp.c
index 5e32ad8e4..6699b4b87 100644
--- a/src/network/core/udp.c
+++ b/src/network/core/udp.c
@@ -116,11 +116,19 @@ void NetworkUDPReceive(const SOCKET udp)
/* Try to receive anything */
nbytes = recvfrom(udp, p.buffer, packet_len, 0, (struct sockaddr *)&client_addr, &client_len);
- /* We got some bytes for the base header of the packet.
- * Assume we received the whole packet. */
+ /* We got some bytes for the base header of the packet. */
if (nbytes > 2) {
NetworkRecv_ReadPacketSize(&p);
+ /* If the size does not match the packet must be corrupted.
+ * Otherwise it will be marked as corrupted later on. */
+ if (nbytes != p.size) {
+ DEBUG(net, 1, "received a packet with mismatching size from %s:%d",
+ inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
+
+ return;
+ }
+
/* Put the position on the right place */
p.pos = 2;
p.next = NULL;
diff --git a/src/network/network_udp.c b/src/network/network_udp.c
index 5caec3b42..f0a72b8a7 100644
--- a/src/network/network_udp.c
+++ b/src/network/network_udp.c
@@ -53,7 +53,7 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_FIND_SERVER)
NetworkSend_NetworkGameInfo(packet, &_network_game_info);
// Let the client know that we are here
- NetworkSendUDP_Packet(_udp_server_socket, packet, client_addr);
+// NetworkSendUDP_Packet(_udp_server_socket, packet, client_addr);
free(packet);