From: Mark McDuff Date: Mon, 1 Jun 2015 21:57:10 +0000 (-0700) Subject: AsyncServerSocket: more tries for binding to a port X-Git-Tag: v0.42.0~6 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ff7e12b66345f2b70d1c7657f72bd4c35518bd10;p=folly.git AsyncServerSocket: more tries for binding to a port Summary: User reports of intermittent failures at 5. Setting up a server is expensive. Binding to a socket is pretty cheap. Why not 25 tries? Why not 100? Test Plan: hope Reviewed By: alandau@fb.com Subscribers: folly-diffs@, yfeldblum, chalfant FB internal diff: D2116187 Signature: t1:2116187:1433199889:09d6916eddf8521f120894ce361c3e1a96905c90 --- diff --git a/folly/io/async/AsyncServerSocket.cpp b/folly/io/async/AsyncServerSocket.cpp index b48129c4..8520f464 100644 --- a/folly/io/async/AsyncServerSocket.cpp +++ b/folly/io/async/AsyncServerSocket.cpp @@ -396,7 +396,7 @@ void AsyncServerSocket::bind(uint16_t port) { } }; - const int kNumTries = 5; + const int kNumTries = 25; for (int tries = 1; true; tries++) { // Prefer AF_INET6 addresses. RFC 3484 mandates that getaddrinfo // should return IPv6 first and then IPv4 addresses, but glibc's