| OLD | NEW |
| 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_WIN_H_ | 5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ |
| 6 #define NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ | 6 #define NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ |
| 7 | 7 |
| 8 #include <winsock2.h> | 8 #include <winsock2.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 TCPServerSocketWin(net::NetLog* net_log, | 27 TCPServerSocketWin(net::NetLog* net_log, |
| 28 const net::NetLog::Source& source); | 28 const net::NetLog::Source& source); |
| 29 ~TCPServerSocketWin(); | 29 ~TCPServerSocketWin(); |
| 30 | 30 |
| 31 // net::ServerSocket implementation. | 31 // net::ServerSocket implementation. |
| 32 virtual int Listen(const net::IPEndPoint& address, int backlog); | 32 virtual int Listen(const net::IPEndPoint& address, int backlog); |
| 33 virtual int GetLocalAddress(IPEndPoint* address) const; | 33 virtual int GetLocalAddress(IPEndPoint* address) const; |
| 34 virtual int Accept(scoped_ptr<StreamSocket>* socket, | 34 virtual int Accept(scoped_ptr<StreamSocket>* socket, |
| 35 const CompletionCallback& callback); | 35 const CompletionCallback& callback); |
| 36 | 36 |
| 37 // Sets corresponding flags to allow the socket to share the local address to |
| 38 // which the socket will be bound with other processes. Should be called |
| 39 // before Bind(). |
| 40 void AllowAddressReuse(); |
| 41 |
| 37 // base::ObjectWatcher::Delegate implementation. | 42 // base::ObjectWatcher::Delegate implementation. |
| 38 virtual void OnObjectSignaled(HANDLE object); | 43 virtual void OnObjectSignaled(HANDLE object); |
| 39 | 44 |
| 40 private: | 45 private: |
| 46 int SetSocketOptions(); |
| 41 int AcceptInternal(scoped_ptr<StreamSocket>* socket); | 47 int AcceptInternal(scoped_ptr<StreamSocket>* socket); |
| 42 void Close(); | 48 void Close(); |
| 43 | 49 |
| 44 SOCKET socket_; | 50 SOCKET socket_; |
| 45 HANDLE socket_event_; | 51 HANDLE socket_event_; |
| 46 | 52 |
| 47 base::win::ObjectWatcher accept_watcher_; | 53 base::win::ObjectWatcher accept_watcher_; |
| 48 | 54 |
| 49 scoped_ptr<StreamSocket>* accept_socket_; | 55 scoped_ptr<StreamSocket>* accept_socket_; |
| 50 CompletionCallback accept_callback_; | 56 CompletionCallback accept_callback_; |
| 51 | 57 |
| 58 bool reuse_address_; |
| 59 |
| 52 BoundNetLog net_log_; | 60 BoundNetLog net_log_; |
| 53 }; | 61 }; |
| 54 | 62 |
| 55 } // namespace net | 63 } // namespace net |
| 56 | 64 |
| 57 #endif // NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ | 65 #endif // NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ |
| OLD | NEW |