mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-03-10 12:01:43 +00:00
UDP_Init: don't bother calling gethostbyname() if our hostname ends in ".local"
(a macOS thing), because it blocks for a few seconds and then fails (on my system anyway), so it's pointless. Fixes an annoying startup pause on macOS, which was reported as https://sourceforge.net/p/quakespasm/bugs/15/ git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1403 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
f92ce77fc9
commit
4bea6d51e2
1 changed files with 11 additions and 0 deletions
|
@ -59,6 +59,16 @@ sys_socket_t UDP_Init (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buff[MAXHOSTNAMELEN - 1] = 0;
|
buff[MAXHOSTNAMELEN - 1] = 0;
|
||||||
|
|
||||||
|
// ericw -- if our hostname ends in ".local" (a macOS thing),
|
||||||
|
// don't bother calling gethostbyname(), because it blocks for a few seconds
|
||||||
|
// and then fails (on my system anyway.)
|
||||||
|
if (strstr(buff, ".local") == (buff + strlen(buff) - 6))
|
||||||
|
{
|
||||||
|
Con_SafePrintf("UDP_Init: skipping gethostbyname for %s\n", buff);
|
||||||
|
goto skip_gethostbyname;
|
||||||
|
}
|
||||||
|
|
||||||
local = gethostbyname(buff);
|
local = gethostbyname(buff);
|
||||||
if (local == NULL)
|
if (local == NULL)
|
||||||
{
|
{
|
||||||
|
@ -75,6 +85,7 @@ sys_socket_t UDP_Init (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip_gethostbyname:
|
||||||
if ((net_controlsocket = UDP_OpenSocket(0)) == INVALID_SOCKET)
|
if ((net_controlsocket = UDP_OpenSocket(0)) == INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
Con_SafePrintf("UDP_Init: Unable to open control socket, UDP disabled\n");
|
Con_SafePrintf("UDP_Init: Unable to open control socket, UDP disabled\n");
|
||||||
|
|
Loading…
Reference in a new issue