Commit 8ff6c23c authored by vitalyr@chromium.org's avatar vitalyr@chromium.org

Allow rapid socket reuse on POSIX platforms.

Review URL: http://codereview.chromium.org/5990001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6066 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 578e70a5
......@@ -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(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment