mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-30 20:50:42 +00:00
added winsock init/cleanup
This commit is contained in:
parent
818f5de658
commit
6fd5239e52
1 changed files with 14 additions and 0 deletions
|
@ -123,7 +123,14 @@ UDP_Init (void)
|
||||||
char buff[MAXHOSTNAMELEN];
|
char buff[MAXHOSTNAMELEN];
|
||||||
struct qsockaddr addr;
|
struct qsockaddr addr;
|
||||||
char *colon;
|
char *colon;
|
||||||
|
#ifdef _WIN32
|
||||||
|
WSADATA winsockdata;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
r = WSAStartup (MAKEWORD (1, 1), &winsockdata);
|
||||||
|
if (r)
|
||||||
|
Sys_Error ("Winsock initialization failed.");
|
||||||
|
#endif
|
||||||
if (COM_CheckParm ("-noudp"))
|
if (COM_CheckParm ("-noudp"))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -165,6 +172,7 @@ void
|
||||||
UDP_Shutdown (void)
|
UDP_Shutdown (void)
|
||||||
{
|
{
|
||||||
UDP_Listen (false);
|
UDP_Listen (false);
|
||||||
|
|
||||||
UDP_CloseSocket (net_controlsocket);
|
UDP_CloseSocket (net_controlsocket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +230,13 @@ UDP_CloseSocket (int socket)
|
||||||
{
|
{
|
||||||
if (socket == net_broadcastsocket)
|
if (socket == net_broadcastsocket)
|
||||||
net_broadcastsocket = 0;
|
net_broadcastsocket = 0;
|
||||||
|
#ifdef _WIN32
|
||||||
|
closesocket (socket);
|
||||||
|
WSACleanup ();
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
return close (socket);
|
return close (socket);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue