mirror of
https://github.com/glest/glest-source.git
synced 2025-02-25 12:12:25 +01:00
- small network optimization to help stabilize frequently called network code
This commit is contained in:
parent
70817a07d1
commit
19892ff11d
@ -1228,15 +1228,17 @@ bool Socket::isConnected() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string Socket::getHostName() {
|
string Socket::getHostName() {
|
||||||
const int strSize= 257;
|
static string host = "";
|
||||||
char hostname[strSize]="";
|
if(host == "") {
|
||||||
int result = gethostname(hostname, strSize);
|
const int strSize= 257;
|
||||||
string host = "";
|
char hostname[strSize]="";
|
||||||
if(result == 0) {
|
int result = gethostname(hostname, strSize);
|
||||||
host = (hostname[0] != '\0' ? hostname : "");
|
if(result == 0) {
|
||||||
}
|
host = (hostname[0] != '\0' ? hostname : "");
|
||||||
else {
|
}
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] result = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,result,getLastSocketErrorText());
|
else {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] result = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,result,getLastSocketErrorText());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user