Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Unified Diff: src/platform-linux.cc

Issue 50036: Add support for setting the SO_REUSEADDR option for sockets (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-linux.cc
===================================================================
--- src/platform-linux.cc (revision 1552)
+++ src/platform-linux.cc (working copy)
@@ -668,6 +668,8 @@
int Send(const char* data, int len) const;
int Receive(char* data, int len) const;
+ bool SetReuseAddress(bool reuse_address);
+
bool IsValid() const { return socket_ != -1; }
private:
@@ -764,6 +766,13 @@
}
+bool LinuxSocket::SetReuseAddress(bool reuse_address) {
+ int on = reuse_address ? 1 : 0;
+ int status = setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+ return status == 0;
+}
+
+
bool Socket::Setup() {
// Nothing to do on Linux.
return true;
« no previous file with comments | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698