mirror of
https://github.com/UberGames/GtkRadiant.git
synced 2024-11-25 05:11:43 +00:00
error handling in watchbsp (contributed by ilm)
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@250 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
parent
4d18333524
commit
0d8ed0a523
3 changed files with 16 additions and 3 deletions
|
@ -346,7 +346,9 @@ void Net_MyAddress(address_t *address)
|
|||
//===========================================================================
|
||||
int Net_Setup(void)
|
||||
{
|
||||
WINS_Init();
|
||||
if( !WINS_Init() )
|
||||
return qfalse;
|
||||
|
||||
//
|
||||
WinPrint("my address is %s\n", WINS_MyAddress());
|
||||
//
|
||||
|
|
|
@ -175,6 +175,14 @@ int WINS_Init(void)
|
|||
// determine my name & address
|
||||
gethostname(buff, MAXHOSTNAMELEN);
|
||||
local = gethostbyname(buff);
|
||||
|
||||
// When hostname can not be resolved, return gracefully
|
||||
if( local == 0 )
|
||||
{
|
||||
WinError("WINS_Init: Unable to resolve hostname\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
myAddr = *(int *)local->h_addr_list[0];
|
||||
|
||||
// if the quake hostname isn't set, set it to the machine name
|
||||
|
|
|
@ -305,10 +305,13 @@ bool CWatchBSP::SetupListening()
|
|||
}
|
||||
#endif
|
||||
Sys_Printf("Setting up\n");
|
||||
Net_Setup();
|
||||
if( !Net_Setup() )
|
||||
return false;
|
||||
|
||||
m_pListenSocket = Net_ListenSocket(39000);
|
||||
if (m_pListenSocket == NULL)
|
||||
return false;
|
||||
|
||||
Sys_Printf("Listening...\n");
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue