mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 11:42:31 +01:00
- no need to crash if admin port already in use, just output error to console
This commit is contained in:
parent
3773736212
commit
07c2af4b99
@ -84,7 +84,7 @@ bool NetworkManager::isNetworkGame() {
|
||||
|
||||
GameNetworkInterface* NetworkManager::getGameNetworkInterface(bool throwErrorOnNull) {
|
||||
if(throwErrorOnNull) {
|
||||
assert(gameNetworkInterface!=NULL);
|
||||
//assert(gameNetworkInterface!=NULL);
|
||||
|
||||
if(gameNetworkInterface==NULL) {
|
||||
throw megaglest_runtime_error("gameNetworkInterface==NULL");
|
||||
@ -95,7 +95,7 @@ GameNetworkInterface* NetworkManager::getGameNetworkInterface(bool throwErrorOnN
|
||||
|
||||
ServerInterface* NetworkManager::getServerInterface(bool throwErrorOnNull) {
|
||||
if(throwErrorOnNull) {
|
||||
assert(gameNetworkInterface!=NULL);
|
||||
//assert(gameNetworkInterface!=NULL);
|
||||
if(gameNetworkInterface==NULL) {
|
||||
throw megaglest_runtime_error("gameNetworkInterface==NULL");
|
||||
}
|
||||
@ -112,7 +112,7 @@ ClientInterface* NetworkManager::getClientInterface(bool throwErrorOnNull) {
|
||||
//if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] this->networkRole = %d gameNetworkInterface [%p]\n",__FILE__,__FUNCTION__,__LINE__,this->networkRole,gameNetworkInterface);
|
||||
|
||||
if(throwErrorOnNull) {
|
||||
assert(gameNetworkInterface!=NULL);
|
||||
//assert(gameNetworkInterface!=NULL);
|
||||
if(gameNetworkInterface==NULL) {
|
||||
throw megaglest_runtime_error("gameNetworkInterface==NULL");
|
||||
}
|
||||
|
@ -78,11 +78,19 @@ ServerInterface::ServerInterface(bool publishEnabled) :GameNetworkInterface() {
|
||||
// This is an admin port listening only on the localhost intended to
|
||||
// give current connection status info
|
||||
#ifndef __APPLE__
|
||||
serverSocketAdmin = new ServerSocket(true);
|
||||
serverSocketAdmin->setBlock(false);
|
||||
serverSocketAdmin->setBindPort(Config::getInstance().getInt("ServerAdminPort", intToStr(GameConstants::serverAdminPort).c_str()));
|
||||
serverSocketAdmin->setBindSpecificAddress(Config::getInstance().getString("ServerAdminBindAddress", "127.0.0.1"));
|
||||
serverSocketAdmin->listen(5);
|
||||
try {
|
||||
serverSocketAdmin = new ServerSocket(true);
|
||||
serverSocketAdmin->setBlock(false);
|
||||
serverSocketAdmin->setBindPort(Config::getInstance().getInt("ServerAdminPort", intToStr(GameConstants::serverAdminPort).c_str()));
|
||||
serverSocketAdmin->setBindSpecificAddress(Config::getInstance().getString("ServerAdminBindAddress", "127.0.0.1"));
|
||||
serverSocketAdmin->listen(5);
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Warning Server admin port bind/listen error:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
}
|
||||
#endif
|
||||
|
||||
maxFrameCountLagAllowed = Config::getInstance().getInt("MaxFrameCountLagAllowed", intToStr(maxFrameCountLagAllowed).c_str());
|
||||
|
Loading…
x
Reference in New Issue
Block a user