Index: src/platform-posix.cc |
diff --git a/src/platform-posix.cc b/src/platform-posix.cc |
index c50d396ad3822542dbaf75c56986913d5c412618..0cec2e51345ffc024ffe4dc5303d4c109b40ee06 100644 |
--- a/src/platform-posix.cc |
+++ b/src/platform-posix.cc |
@@ -204,6 +204,14 @@ class POSIXSocket : public Socket { |
explicit POSIXSocket() { |
// Create the socket. |
socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
+ if (IsValid()) { |
+ // Allow rapid reuse. |
+ static const int kOn = 1; |
+ int ret = setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, |
+ &kOn, sizeof(kOn)); |
+ ASSERT(ret == 0); |
+ USE(ret); |
+ } |
} |
explicit POSIXSocket(int socket): socket_(socket) { } |
virtual ~POSIXSocket() { Shutdown(); } |