Skip to content
GitLab
Menu
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-devel
Commits
c4d4a918
Commit
c4d4a918
authored
Dec 02, 2005
by
Mike Hibler
Browse files
Don't try so many times (10) to bind to the same port
and return a distinct error when we fail to get the port
parent
7e5633a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
os/frisbee.redux/client.c
View file @
c4d4a918
...
...
@@ -1182,7 +1182,7 @@ PlayFrisbee(void)
delay
=
0
;
if
(
delay
)
{
if
(
debug
)
log
(
"Starup delay: %d.%03d seconds"
,
log
(
"Star
t
up delay: %d.%03d seconds"
,
delay
/
1000
,
delay
%
1000
);
DOSTAT
(
delayms
=
delay
);
fsleep
(
delay
*
1000
);
...
...
os/frisbee.redux/log.h
View file @
c4d4a918
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2002 University of Utah and the Flux Group.
* Copyright (c) 2000-2002
, 2005
University of Utah and the Flux Group.
* All rights reserved.
*/
...
...
@@ -13,6 +13,7 @@ int ClientLogInit(void);
int
ServerLogInit
(
void
);
void
log
(
const
char
*
fmt
,
...);
void
warning
(
const
char
*
fmt
,
...);
void
error
(
const
char
*
fmt
,
...);
void
fatal
(
const
char
*
fmt
,
...);
void
pwarning
(
const
char
*
fmt
,
...);
void
pfatal
(
const
char
*
fmt
,
...);
os/frisbee.redux/network.c
View file @
c4d4a918
...
...
@@ -30,7 +30,7 @@ unsigned long nonetbufs;
#endif
/* Max number of times to attempt bind to port before failing. */
#define MAXBINDATTEMPTS
10
#define MAXBINDATTEMPTS
2
/* Max number of hops multicast hops. */
#define MCAST_TTL 5
...
...
@@ -71,8 +71,15 @@ CommonInit(void)
if
(
bind
(
sock
,
(
struct
sockaddr
*
)
&
name
,
sizeof
(
name
))
==
0
)
break
;
if
(
--
i
==
0
)
pfatal
(
"Could not bind to port %d!"
,
portnum
);
/*
* Note that we exit with a magic value.
* This is for server wrapper-scripts so that they can
* differentiate this case and try again with a different port.
*/
if
(
--
i
==
0
)
{
error
(
"Could not bind to port %d!
\n
"
,
portnum
);
exit
(
EADDRINUSE
);
}
pwarning
(
"Bind to port %d failed. Will try %d more times!"
,
portnum
,
i
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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