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 #include "content/browser/renderer_host/p2p/socket_host_udp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
6 | 6 |
7 #include "content/common/p2p_messages.h" | 7 #include "content/common/p2p_messages.h" |
8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 // UDP packets cannot be bigger than 64k. | 14 // UDP packets cannot be bigger than 64k. |
15 const int kReadBufferSize = 65536; | 15 const int kReadBufferSize = 65536; |
16 | 16 |
17 } // namespace | 17 } // namespace |
18 | 18 |
| 19 namespace content { |
| 20 |
19 P2PSocketHostUdp::P2PSocketHostUdp(IPC::Message::Sender* message_sender, | 21 P2PSocketHostUdp::P2PSocketHostUdp(IPC::Message::Sender* message_sender, |
20 int routing_id, int id) | 22 int routing_id, int id) |
21 : P2PSocketHost(message_sender, routing_id, id), | 23 : P2PSocketHost(message_sender, routing_id, id), |
22 socket_(new net::UDPServerSocket(NULL, net::NetLog::Source())), | 24 socket_(new net::UDPServerSocket(NULL, net::NetLog::Source())), |
23 send_pending_(false), | 25 send_pending_(false), |
24 ALLOW_THIS_IN_INITIALIZER_LIST( | 26 ALLOW_THIS_IN_INITIALIZER_LIST( |
25 recv_callback_(this, &P2PSocketHostUdp::OnRecv)), | 27 recv_callback_(this, &P2PSocketHostUdp::OnRecv)), |
26 ALLOW_THIS_IN_INITIALIZER_LIST( | 28 ALLOW_THIS_IN_INITIALIZER_LIST( |
27 send_callback_(this, &P2PSocketHostUdp::OnSend)) { | 29 send_callback_(this, &P2PSocketHostUdp::OnSend)) { |
28 } | 30 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if (result < 0) | 164 if (result < 0) |
163 OnError(); | 165 OnError(); |
164 } | 166 } |
165 | 167 |
166 P2PSocketHost* P2PSocketHostUdp::AcceptIncomingTcpConnection( | 168 P2PSocketHost* P2PSocketHostUdp::AcceptIncomingTcpConnection( |
167 const net::IPEndPoint& remote_address, int id) { | 169 const net::IPEndPoint& remote_address, int id) { |
168 NOTREACHED(); | 170 NOTREACHED(); |
169 OnError(); | 171 OnError(); |
170 return NULL; | 172 return NULL; |
171 } | 173 } |
| 174 |
| 175 } // namespace content |
OLD | NEW |