mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=10506
This commit is contained in:
parent
0101a1ae63
commit
610c331ead
|
@ -6743,3 +6743,20 @@ David 23 June 2006
|
|||
lib/
|
||||
prefs.C
|
||||
util.C
|
||||
|
||||
David 23 June 2006
|
||||
- core client:
|
||||
- removed Apple-specific retry logic in get_local_network_info()
|
||||
- made get_local_network_info() a member of HOST_INFO
|
||||
- in 1-sec poll loop, if don't have a domain name,
|
||||
call get_local_network_info() again
|
||||
(on some systems, gethostbyname() takes a few minutes to work)
|
||||
|
||||
client/
|
||||
client_state.C
|
||||
hostinfo_network.C
|
||||
hostinfo_unix.C
|
||||
win/
|
||||
hostinfo_win.cpp
|
||||
lib/
|
||||
hostinfo.h
|
||||
|
|
|
@ -515,6 +515,14 @@ bool CLIENT_STATE::poll_slow_events() {
|
|||
return true;
|
||||
} else {
|
||||
time_stats.update(!tasks_suspended);
|
||||
|
||||
// on some systems, gethostbyname() only starts working
|
||||
// a few minutes after system boot.
|
||||
// If it didn't work before, try it again.
|
||||
//
|
||||
if (!strlen(host_info.domain_name)) {
|
||||
host_info.get_local_network_info();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,32 +57,20 @@
|
|||
|
||||
// get domain name and IP address of this host
|
||||
//
|
||||
int get_local_network_info(
|
||||
char* domain_name, int domlen, char* ip_addr, int iplen
|
||||
) {
|
||||
int HOST_INFO::get_local_network_info() {
|
||||
char buf[256];
|
||||
struct in_addr addr;
|
||||
struct hostent* he;
|
||||
if (gethostname(buf, 256)) return ERR_GETHOSTBYNAME;
|
||||
|
||||
#ifdef __APPLE__
|
||||
short retryCount = 20; // Used when launching BOINC as a daemon / service at system startup
|
||||
retry:
|
||||
#endif
|
||||
if (gethostname(buf, 256)) return ERR_GETHOSTBYNAME;
|
||||
he = gethostbyname(buf);
|
||||
if (!he || !he->h_addr_list[0]) {
|
||||
#ifdef __APPLE__
|
||||
if ((TickCount() < (120*60)) && (--retryCount > 0)) { // If system has been up for less than 2 minutes
|
||||
boinc_sleep(0.5); // allow time for gethostbyname to be initialized
|
||||
goto retry; // Max delay is 20 * 0.5 = 10 seconds
|
||||
}
|
||||
#endif
|
||||
msg_printf(NULL, MSG_ERROR, "gethostbyname failed");
|
||||
msg_printf(NULL, MSG_ERROR, "gethostbyname (%s) failed", buf);
|
||||
return ERR_GETHOSTBYNAME;
|
||||
}
|
||||
strlcpy(domain_name, he->h_name, domlen);
|
||||
strlcpy(domain_name, he->h_name, sizeof(domain_name));
|
||||
memcpy(&addr, he->h_addr_list[0], sizeof(addr));
|
||||
strlcpy(ip_addr, inet_ntoa(addr), iplen);
|
||||
strlcpy(ip_addr, inet_ntoa(addr), sizeof(ip_addr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -492,9 +492,7 @@ int HOST_INFO::get_host_info() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
get_local_network_info(
|
||||
domain_name, sizeof(domain_name), ip_addr, sizeof(ip_addr)
|
||||
);
|
||||
get_local_network_info();
|
||||
|
||||
timezone = get_timezone();
|
||||
#ifdef HAVE_SYS_UTSNAME_H
|
||||
|
|
|
@ -618,9 +618,7 @@ int HOST_INFO::get_host_info() {
|
|||
);
|
||||
|
||||
// Detect host name/ip info
|
||||
get_local_network_info(
|
||||
domain_name, sizeof(domain_name), ip_addr, sizeof(ip_addr)
|
||||
);
|
||||
get_local_network_info();
|
||||
|
||||
// Detect which accelerators are installed on the system
|
||||
get_accelerators(
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
bool host_is_running_on_batteries();
|
||||
bool users_idle(bool check_all_logins, double idle_time_to_run);
|
||||
int get_host_info();
|
||||
int get_local_network_info();
|
||||
void clear_host_info();
|
||||
void make_random_string(const char* salt, char* out);
|
||||
void generate_host_cpid();
|
||||
|
|
Loading…
Reference in New Issue