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

Unified Diff: net/socket/tcp_server_socket_libevent.h

Issue 10907154: Allow server sockets to rebind to same port if there is nothing actively listening on that port. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review changes Created 8 years, 3 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 | « no previous file | net/socket/tcp_server_socket_libevent.cc » ('j') | net/socket/tcp_server_socket_win.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_server_socket_libevent.h
diff --git a/net/socket/tcp_server_socket_libevent.h b/net/socket/tcp_server_socket_libevent.h
index 946cc50f949d56911d0a0a437a0c02b3dfd95165..4ec879aaff53cc3d65f7b5aece0bed57cb55d5d5 100644
--- a/net/socket/tcp_server_socket_libevent.h
+++ b/net/socket/tcp_server_socket_libevent.h
@@ -35,12 +35,29 @@ class NET_EXPORT_PRIVATE TCPServerSocketLibevent
virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
+ // Sets corresponding flags in |socket_options_| to allow the socket
+ // to share the local address to which the socket will be bound with
+ // other processes. Should be called before Bind().
+ void AllowAddressReuse();
+
private:
int AcceptInternal(scoped_ptr<StreamSocket>* socket);
void Close();
+ enum SocketOptions {
Sergey Ulanov 2012/09/12 19:38:24 types must be defined before methods.
justinlin 2012/09/12 21:11:00 Ack.
+ SOCKET_OPTION_REUSE_ADDRESS = 1 << 0,
+ };
+
+ // Applies |socket_options_| to |socket_|. Should be called before
+ // Bind().
+ int SetSocketOptions();
+
int socket_;
+ // Bitwise-or'd combination of SocketOptions. Specifies the set of
+ // options that should be applied to |socket_| before Bind().
+ int socket_options_;
Sergey Ulanov 2012/09/12 19:38:24 Do we really need these options to be bit flags? i
Sergey Ulanov 2012/09/12 19:38:24 You need to initialize this variable in the constr
justinlin 2012/09/12 21:11:00 Done.
justinlin 2012/09/12 21:11:00 Done.
+
MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_;
scoped_ptr<StreamSocket>* accept_socket_;
« no previous file with comments | « no previous file | net/socket/tcp_server_socket_libevent.cc » ('j') | net/socket/tcp_server_socket_win.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698