net_sdlnet.c: reverted parts of rev. 197/198.

git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@219 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2010-06-21 13:27:30 +00:00
parent 1f9a960e86
commit b1835226d6

View file

@ -28,16 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAX_SOCKETS 32 #define MAX_SOCKETS 32
#if 0 /* enable for paranoid debugging purposes */
#define ASSERT_SOCKETID(s) \
do { \
if ((s) < 0 || (s) >= MAX_SOCKETS) \
Sys_Error("Bad socket ID %d at line %d",(s),__LINE__); \
} while (0)
#else
#define ASSERT_SOCKETID(s) do {} while (0)
#endif
static int net_controlsocket; static int net_controlsocket;
static int net_broadcastsocket = 0; static int net_broadcastsocket = 0;
static int net_acceptsocket = -1; static int net_acceptsocket = -1;
@ -131,10 +121,9 @@ int SDLN_Init (void)
else else
{ {
/* with SDL_net, there is no way of doing an /* with SDL_net, there is no way of doing an
equivalent of gethostaddr() / gethostbyname() equivalent of gethostaddr() / gethostbyname(). */
so we do this crap as a fallback. */ SDLNet_ResolveHost(&myaddr, NULL, 0);
SDLNet_ResolveHost(&myaddr, "localhost", 0); strcpy(my_tcpip_address, "INADDR_ANY");
strcpy(my_tcpip_address, _IPAddrToString(&myaddr));
} }
// open the control socket // open the control socket
@ -166,7 +155,7 @@ void SDLN_GetLocalAddress (void)
if (myaddr.host != INADDR_ANY) if (myaddr.host != INADDR_ANY)
return; return;
SDLNet_ResolveHost(&myaddr, "localhost", 0); SDLNet_ResolveHost(&myaddr, NULL, 0);
} }
void SDLN_Listen (qboolean state) void SDLN_Listen (qboolean state)
@ -223,7 +212,7 @@ int SDLN_CloseSocket (int socketid)
if (socketid == net_broadcastsocket) if (socketid == net_broadcastsocket)
net_broadcastsocket = -1; net_broadcastsocket = -1;
ASSERT_SOCKETID(socketid);
socket_p = net_sockets[socketid]; socket_p = net_sockets[socketid];
if (socket_p == NULL) if (socket_p == NULL)
@ -269,7 +258,6 @@ int SDLN_Read (int socketid, byte *buf, int len, struct qsockaddr *addr)
IPaddress *ipaddress; IPaddress *ipaddress;
UDPsocket socket_p; UDPsocket socket_p;
ASSERT_SOCKETID(socketid);
socket_p = net_sockets[socketid]; socket_p = net_sockets[socketid];
if (socket_p == NULL) if (socket_p == NULL)
return -1; return -1;
@ -299,7 +287,6 @@ int SDLN_Write (int socketid, byte *buf, int len, struct qsockaddr *addr)
UDPsocket socket_p; UDPsocket socket_p;
IPaddress *ipaddress; IPaddress *ipaddress;
ASSERT_SOCKETID(socketid);
socket_p = net_sockets[socketid]; socket_p = net_sockets[socketid];
if (socket_p == NULL) if (socket_p == NULL)
return -1; return -1;
@ -372,7 +359,7 @@ int SDLN_GetSocketAddr (int socketid, struct qsockaddr *addr)
IPaddress *ipaddress; IPaddress *ipaddress;
Q_memset(addr, 0, sizeof(struct qsockaddr)); Q_memset(addr, 0, sizeof(struct qsockaddr));
ASSERT_SOCKETID(socketid);
socket_p = net_sockets[socketid]; socket_p = net_sockets[socketid];
if (socket_p == NULL) if (socket_p == NULL)
return -1; return -1;