| 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 CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 public: | 28 public: |
| 29 typedef std::map<net::IPEndPoint, net::StreamSocket*> AcceptedSocketsMap; | 29 typedef std::map<net::IPEndPoint, net::StreamSocket*> AcceptedSocketsMap; |
| 30 | 30 |
| 31 P2PSocketHostTcpServer(IPC::Sender* message_sender, | 31 P2PSocketHostTcpServer(IPC::Sender* message_sender, |
| 32 int socket_id, | 32 int socket_id, |
| 33 P2PSocketType client_type); | 33 P2PSocketType client_type); |
| 34 virtual ~P2PSocketHostTcpServer(); | 34 virtual ~P2PSocketHostTcpServer(); |
| 35 | 35 |
| 36 // P2PSocketHost overrides. | 36 // P2PSocketHost overrides. |
| 37 virtual bool Init(const net::IPEndPoint& local_address, | 37 virtual bool Init(const net::IPEndPoint& local_address, |
| 38 const P2PHostAndIPEndPoint& remote_address) OVERRIDE; | 38 const P2PHostAndIPEndPoint& remote_address) override; |
| 39 virtual void Send(const net::IPEndPoint& to, | 39 virtual void Send(const net::IPEndPoint& to, |
| 40 const std::vector<char>& data, | 40 const std::vector<char>& data, |
| 41 const rtc::PacketOptions& options, | 41 const rtc::PacketOptions& options, |
| 42 uint64 packet_id) OVERRIDE; | 42 uint64 packet_id) override; |
| 43 virtual P2PSocketHost* AcceptIncomingTcpConnection( | 43 virtual P2PSocketHost* AcceptIncomingTcpConnection( |
| 44 const net::IPEndPoint& remote_address, int id) OVERRIDE; | 44 const net::IPEndPoint& remote_address, int id) override; |
| 45 virtual bool SetOption(P2PSocketOption option, int value) OVERRIDE; | 45 virtual bool SetOption(P2PSocketOption option, int value) override; |
| 46 | 46 |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 friend class P2PSocketHostTcpServerTest; | 49 friend class P2PSocketHostTcpServerTest; |
| 50 | 50 |
| 51 void OnError(); | 51 void OnError(); |
| 52 | 52 |
| 53 void DoAccept(); | 53 void DoAccept(); |
| 54 void HandleAcceptResult(int result); | 54 void HandleAcceptResult(int result); |
| 55 | 55 |
| 56 // Callback for Accept(). | 56 // Callback for Accept(). |
| 57 void OnAccepted(int result); | 57 void OnAccepted(int result); |
| 58 | 58 |
| 59 const P2PSocketType client_type_; | 59 const P2PSocketType client_type_; |
| 60 scoped_ptr<net::ServerSocket> socket_; | 60 scoped_ptr<net::ServerSocket> socket_; |
| 61 net::IPEndPoint local_address_; | 61 net::IPEndPoint local_address_; |
| 62 | 62 |
| 63 scoped_ptr<net::StreamSocket> accept_socket_; | 63 scoped_ptr<net::StreamSocket> accept_socket_; |
| 64 AcceptedSocketsMap accepted_sockets_; | 64 AcceptedSocketsMap accepted_sockets_; |
| 65 | 65 |
| 66 net::CompletionCallback accept_callback_; | 66 net::CompletionCallback accept_callback_; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpServer); | 68 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpServer); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace content | 71 } // namespace content |
| 72 | 72 |
| 73 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ | 73 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_SERVER_H_ |
| OLD | NEW |