- Extended confvirtmot to allow for sequences of calls
- Extended confvirtmot to have a checkscript - Made sure that targets get updated when calling tasdrive - Fixed some output codes in tasdrive.c - Made tdchm invoke counters event message for Melone - Fixed the ConID inefficiency by caching the host name in asynnet.c - Added a traceActive function to trace SKIPPED: psi/tdchm.c
This commit is contained in:
20
asynnet.c
20
asynnet.c
@ -57,6 +57,7 @@ typedef struct {
|
||||
ANETcallback readCallback;
|
||||
void *userData;
|
||||
ANETkill killUser;
|
||||
char host[132];
|
||||
} SocketDescriptor, *pSocketDescriptor;
|
||||
|
||||
static SocketDescriptor connections[MAXCONNECTIONS];
|
||||
@ -480,16 +481,19 @@ int ANETinfo(int handle, char *hostname, int hostnameLen)
|
||||
if (con == NULL) {
|
||||
return ANETDISCONNECTED;
|
||||
} else {
|
||||
len = sizeof sin;
|
||||
if (getpeername(con->socket, (struct sockaddr *) &sin, &len) < 0) {
|
||||
return ANETSOCKERROR;
|
||||
}
|
||||
if ((host = gethostbyaddr((char *) &sin.sin_addr,
|
||||
sizeof(sin.sin_addr), AF_INET)) == NULL) {
|
||||
return ANETSOCKERROR;
|
||||
if(strlen(con->host) < 3){
|
||||
len = sizeof sin;
|
||||
if (getpeername(con->socket, (struct sockaddr *) &sin, &len) < 0) {
|
||||
return ANETSOCKERROR;
|
||||
}
|
||||
if ((host = gethostbyaddr((char *) &sin.sin_addr,
|
||||
sizeof(sin.sin_addr), AF_INET)) == NULL) {
|
||||
return ANETSOCKERROR;
|
||||
}
|
||||
strlcpy(con->host,host->h_name, 132);
|
||||
}
|
||||
memset(hostname, 0, hostnameLen);
|
||||
strlcpy(hostname, host->h_name, hostnameLen);
|
||||
strlcpy(hostname, con->host, hostnameLen);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user