mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +00:00
Revert "Merge branch 'mserv-is-dumb-and-what-else-is-new' into 'master'"
This reverts merge request !688
This commit is contained in:
parent
098e41e518
commit
1f77551162
1 changed files with 28 additions and 71 deletions
45
src/mserv.c
45
src/mserv.c
|
@ -323,7 +323,7 @@ static INT32 GetServersList(void)
|
|||
//
|
||||
// MS_Connect()
|
||||
//
|
||||
static INT32 MS_SubConnect(const char *ip_addr, const char *str_port, INT32 async, struct sockaddr *bindaddr, socklen_t bindaddrlen)
|
||||
static INT32 MS_Connect(const char *ip_addr, const char *str_port, INT32 async)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)ip_addr;
|
||||
|
@ -355,8 +355,6 @@ static INT32 MS_SubConnect(const char *ip_addr, const char *str_port, INT32 asyn
|
|||
{
|
||||
socket_fd = socket(runp->ai_family, runp->ai_socktype, runp->ai_protocol);
|
||||
if (socket_fd != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
if (!bindaddr || bind(socket_fd, bindaddr, bindaddrlen) == 0)
|
||||
{
|
||||
if (async) // do asynchronous connection
|
||||
{
|
||||
|
@ -397,8 +395,6 @@ static INT32 MS_SubConnect(const char *ip_addr, const char *str_port, INT32 asyn
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
close(socket_fd);
|
||||
}
|
||||
runp = runp->ai_next;
|
||||
}
|
||||
I_freeaddrinfo(ai);
|
||||
|
@ -406,45 +402,6 @@ static INT32 MS_SubConnect(const char *ip_addr, const char *str_port, INT32 asyn
|
|||
return MS_CONNECT_ERROR;
|
||||
}
|
||||
|
||||
static INT32 MS_Connect(const char *ip_addr, const char *str_port, INT32 async)
|
||||
{
|
||||
const char *lhost;
|
||||
struct my_addrinfo hints;
|
||||
struct my_addrinfo *ai, *aip;
|
||||
int c;
|
||||
if (M_CheckParm("-bindaddr") && ( lhost = M_GetNextParm() ))
|
||||
{
|
||||
memset (&hints, 0x00, sizeof(hints));
|
||||
#ifdef AI_ADDRCONFIG
|
||||
hints.ai_flags = AI_ADDRCONFIG;
|
||||
#endif
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
if (( c = I_getaddrinfo(lhost, 0, &hints, &ai) ) != 0)
|
||||
{
|
||||
CONS_Printf(
|
||||
"mserv.c: bind to %s: %s\n",
|
||||
lhost,
|
||||
gai_strerror(c));
|
||||
return MS_GETHOSTBYNAME_ERROR;
|
||||
}
|
||||
for (aip = ai; aip; aip = aip->ai_next)
|
||||
{
|
||||
c = MS_SubConnect(ip_addr, str_port, async, aip->ai_addr, aip->ai_addrlen);
|
||||
if (c == 0)
|
||||
{
|
||||
I_freeaddrinfo(ai);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
I_freeaddrinfo(ai);
|
||||
return c;
|
||||
}
|
||||
else
|
||||
return MS_SubConnect(ip_addr, str_port, async, 0, 0);
|
||||
}
|
||||
|
||||
#define NUM_LIST_SERVER MAXSERVERLIST
|
||||
const msg_server_t *GetShortServersList(INT32 room)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue