Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-stable
Commits
f9d18931
Commit
f9d18931
authored
Dec 09, 2014
by
Mike Hibler
Browse files
Add a retry to gethostbyname call if it returns TRY_AGAIN.
There seem to be some issues when booting lots of Moonshots.
parent
69618b7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
clientside/event/proxy/evproxy.c
View file @
f9d18931
...
...
@@ -83,7 +83,7 @@ main(int argc, char **argv)
char
buf
[
BUFSIZ
],
ipaddr
[
32
];
char
hostname
[
MAXHOSTNAMELEN
];
struct
hostent
*
he
;
int
c
;
int
c
,
retries
;
struct
in_addr
myip
;
FILE
*
fp
;
...
...
@@ -136,9 +136,21 @@ main(int argc, char **argv)
if
(
gethostname
(
hostname
,
MAXHOSTNAMELEN
)
==
-
1
)
{
fatal
(
"could not get hostname: %s
\n
"
,
strerror
(
errno
));
}
if
(
!
(
he
=
gethostbyname
(
hostname
)))
{
fatal
(
"could not get IP address from hostname: %s"
,
hostname
);
retries
=
2
;
while
(
retries
--
>
0
)
{
if
(
!
(
he
=
gethostbyname
(
hostname
)))
{
if
(
h_errno
==
TRY_AGAIN
)
{
warning
(
"could not resolve '%s', trying again...
\n
"
,
hostname
);
sleep
(
1
);
continue
;
}
}
break
;
}
if
(
!
he
)
fatal
(
"could not get IP address for hostname %s, errno=%d"
,
hostname
,
h_errno
);
memcpy
((
char
*
)
&
myip
,
he
->
h_addr
,
he
->
h_length
);
strcpy
(
ipaddr
,
inet_ntoa
(
myip
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment