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_UDP_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 struct PendingPacket { | 42 struct PendingPacket { |
43 PendingPacket(const net::IPEndPoint& to, const std::vector<char>& content); | 43 PendingPacket(const net::IPEndPoint& to, const std::vector<char>& content); |
44 ~PendingPacket(); | 44 ~PendingPacket(); |
45 net::IPEndPoint to; | 45 net::IPEndPoint to; |
46 scoped_refptr<net::IOBuffer> data; | 46 scoped_refptr<net::IOBuffer> data; |
47 int size; | 47 int size; |
48 }; | 48 }; |
49 | 49 |
50 void OnError(); | 50 void OnError(); |
| 51 |
51 void DoRead(); | 52 void DoRead(); |
| 53 void OnRecv(int result); |
| 54 void HandleReadResult(int result); |
| 55 |
52 void DoSend(const PendingPacket& packet); | 56 void DoSend(const PendingPacket& packet); |
53 void DidCompleteRead(int result); | |
54 | |
55 // Callbacks for RecvFrom() and SendTo(). | |
56 void OnRecv(int result); | |
57 void OnSend(int result); | 57 void OnSend(int result); |
| 58 void HandleSendResult(int result); |
58 | 59 |
59 scoped_ptr<net::DatagramServerSocket> socket_; | 60 scoped_ptr<net::DatagramServerSocket> socket_; |
60 scoped_refptr<net::IOBuffer> recv_buffer_; | 61 scoped_refptr<net::IOBuffer> recv_buffer_; |
61 net::IPEndPoint recv_address_; | 62 net::IPEndPoint recv_address_; |
62 | 63 |
63 std::deque<PendingPacket> send_queue_; | 64 std::deque<PendingPacket> send_queue_; |
64 int send_queue_bytes_; | |
65 bool send_pending_; | 65 bool send_pending_; |
66 | 66 |
67 // Set of peer for which we have received STUN binding request or | 67 // Set of peer for which we have received STUN binding request or |
68 // response or relay allocation request or response. | 68 // response or relay allocation request or response. |
69 ConnectedPeerSet connected_peers_; | 69 ConnectedPeerSet connected_peers_; |
70 | 70 |
71 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostUdp); | 71 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostUdp); |
72 }; | 72 }; |
73 | 73 |
74 } // namespace content | 74 } // namespace content |
75 | 75 |
76 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ | 76 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ |
OLD | NEW |