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; |