2007-01-14 23:27:40 +01:00
|
|
|
--- linux/net_udp.c.orig Sun Jan 14 16:56:54 2007
|
|
|
|
+++ linux/net_udp.c Sun Jan 14 18:17:28 2007
|
2006-12-29 21:15:45 +01:00
|
|
|
@@ -13,8 +13,12 @@
|
|
|
|
#include <sys/uio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
+#ifdef __linux__
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/errqueue.h>
|
|
|
|
+#else
|
|
|
|
+#include <sys/types.h>
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
#ifdef NeXT
|
|
|
|
#include <libc.h>
|
2007-01-13 04:09:20 +01:00
|
|
|
@@ -187,6 +191,7 @@
|
2006-12-29 21:15:45 +01:00
|
|
|
|
2007-01-13 04:09:20 +01:00
|
|
|
if (ret == -1)
|
|
|
|
{
|
2006-12-29 21:15:45 +01:00
|
|
|
+#ifdef __linux__
|
2007-01-13 04:09:20 +01:00
|
|
|
//linux makes this needlessly complex, couldn't just return the source of the error in from, oh no...
|
|
|
|
struct probehdr rcvbuf;
|
|
|
|
struct iovec iov;
|
2007-01-14 23:27:40 +01:00
|
|
|
@@ -308,9 +313,19 @@
|
2007-01-13 04:09:20 +01:00
|
|
|
continue;
|
2006-12-29 21:15:45 +01:00
|
|
|
}
|
2007-01-13 04:09:20 +01:00
|
|
|
}
|
2007-01-14 23:27:40 +01:00
|
|
|
+#else
|
|
|
|
+ err = errno;
|
|
|
|
|
2007-01-13 04:09:20 +01:00
|
|
|
- //errno = err;
|
|
|
|
- //Com_Printf ("NET_GetPacket: %s\n", LOG_NET, NET_ErrorString());
|
2007-01-14 23:27:40 +01:00
|
|
|
+ if (err == EWOULDBLOCK)
|
|
|
|
+ return 0;
|
|
|
|
+ if (err == ECONNREFUSED)
|
|
|
|
+ {
|
|
|
|
+ SockadrToNetadr (&from, net_from);
|
|
|
|
+ Com_Printf ("NET_GetPacket: %s from %s\n", LOG_NET, NET_ErrorString(), NET_AdrToString (net_from));
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
2007-01-13 04:09:20 +01:00
|
|
|
+ Com_Printf ("NET_GetPacket: %s\n", LOG_NET, NET_ErrorString());
|
2006-12-29 21:15:45 +01:00
|
|
|
+#endif
|
|
|
|
return 0;
|
2007-01-13 04:09:20 +01:00
|
|
|
}
|
|
|
|
|
2007-01-14 23:27:40 +01:00
|
|
|
@@ -426,6 +441,7 @@
|
2006-12-29 21:15:45 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef __linux__
|
|
|
|
// r1: accept icmp unreachables for quick disconnects
|
2007-01-13 04:09:20 +01:00
|
|
|
if (!net_no_recverr->intvalue)
|
2006-12-29 21:15:45 +01:00
|
|
|
{
|
2007-01-14 23:27:40 +01:00
|
|
|
@@ -434,6 +450,7 @@
|
2007-01-13 04:09:20 +01:00
|
|
|
Com_Printf ("UDP_OpenSocket: Couldn't set IP_RECVERR: %s\n", LOG_NET, NET_ErrorString());
|
|
|
|
}
|
2006-12-29 21:15:45 +01:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if (!net_interface || !net_interface[0] || !Q_stricmp(net_interface, "localhost"))
|
|
|
|
address.sin_addr.s_addr = INADDR_ANY;
|