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

Side by Side 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: Remove bitmap 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ 5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_
6 #define NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ 6 #define NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/non_thread_safe.h" 10 #include "base/threading/non_thread_safe.h"
(...skipping 17 matching lines...) Expand all
28 // net::ServerSocket implementation. 28 // net::ServerSocket implementation.
29 virtual int Listen(const net::IPEndPoint& address, int backlog) OVERRIDE; 29 virtual int Listen(const net::IPEndPoint& address, int backlog) OVERRIDE;
30 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; 30 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
31 virtual int Accept(scoped_ptr<StreamSocket>* socket, 31 virtual int Accept(scoped_ptr<StreamSocket>* socket,
32 const CompletionCallback& callback) OVERRIDE; 32 const CompletionCallback& callback) OVERRIDE;
33 33
34 // MessageLoopForIO::Watcher implementation. 34 // MessageLoopForIO::Watcher implementation.
35 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; 35 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
36 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; 36 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
37 37
38 // Sets corresponding flags to allow the socket to share the local address to
39 // which the socket will be bound with other processes. Should be called
40 // before Bind().
41 void AllowAddressReuse();
Sergey Ulanov 2012/09/12 21:52:35 nit: put this above MessageLoopForIO::Watcher
justinlin 2012/09/13 07:12:56 Done.
42
38 private: 43 private:
39 int AcceptInternal(scoped_ptr<StreamSocket>* socket); 44 int AcceptInternal(scoped_ptr<StreamSocket>* socket);
40 void Close(); 45 void Close();
46 int SetSocketOptions();
Sergey Ulanov 2012/09/12 21:52:35 nit: I would place it before AcceptInternal() to r
justinlin 2012/09/13 07:12:56 Done.
wtc 2012/09/13 18:31:55 This seems like a good idea. To be consistent, sho
justinlin 2012/09/14 03:54:40 Done.
41 47
42 int socket_; 48 int socket_;
43 49
44 MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_; 50 MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_;
45 51
46 scoped_ptr<StreamSocket>* accept_socket_; 52 scoped_ptr<StreamSocket>* accept_socket_;
47 CompletionCallback accept_callback_; 53 CompletionCallback accept_callback_;
48 54
55 bool reuse_addr_;
Sergey Ulanov 2012/09/12 21:52:35 nit: reuse_address_
justinlin 2012/09/13 07:12:56 Done.
56
49 BoundNetLog net_log_; 57 BoundNetLog net_log_;
50 }; 58 };
51 59
52 } // namespace net 60 } // namespace net
53 61
54 #endif // NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ 62 #endif // NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_
OLDNEW
« no previous file with comments | « no previous file | net/socket/tcp_server_socket_libevent.cc » ('j') | net/socket/tcp_server_socket_libevent.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698