projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Updates from ddm4
[awesomized/libmemcached]
/
libtest
/
port.cc
diff --git
a/libtest/port.cc
b/libtest/port.cc
index 17e03e494b6ca01f330db4adb6afe02d256055d4..01e0e88b34426e1f014db5fd43346903d004570e 100644
(file)
--- a/
libtest/port.cc
+++ b/
libtest/port.cc
@@
-120,7
+120,7
@@
in_port_t get_free_port()
int retries= 1024;
int retries= 1024;
- while (
retries--
)
+ while (
--retries
)
{
int sd;
if ((sd= socket(AF_INET, SOCK_STREAM, 0)) != -1)
{
int sd;
if ((sd= socket(AF_INET, SOCK_STREAM, 0)) != -1)
@@
-155,11
+155,21
@@
in_port_t get_free_port()
}
// We handle the case where if we max out retries, we still abort.
}
// We handle the case where if we max out retries, we still abort.
- if (ret_port <= 1024)
+ if (retries == 0)
+ {
+ fatal_message("No port could be found, exhausted retry");
+ }
+
+ if (ret_port == 0)
{
fatal_message("No port could be found");
}
{
fatal_message("No port could be found");
}
+ if (ret_port <= 1024)
+ {
+ fatal_message("No port could be found, though some where available below or at 1024");
+ }
+
return ret_port;
}
return ret_port;
}