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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/common/p2p_messages.h" | 8 #include "content/common/p2p_messages.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 const net::IPEndPoint& to, const std::vector<char>& content) | 23 const net::IPEndPoint& to, const std::vector<char>& content) |
24 : to(to), | 24 : to(to), |
25 data(new net::IOBuffer(content.size())), | 25 data(new net::IOBuffer(content.size())), |
26 size(content.size()) { | 26 size(content.size()) { |
27 memcpy(data->data(), &content[0], size); | 27 memcpy(data->data(), &content[0], size); |
28 } | 28 } |
29 | 29 |
30 P2PSocketHostUdp::PendingPacket::~PendingPacket() { | 30 P2PSocketHostUdp::PendingPacket::~PendingPacket() { |
31 } | 31 } |
32 | 32 |
33 P2PSocketHostUdp::P2PSocketHostUdp(IPC::Message::Sender* message_sender, | 33 P2PSocketHostUdp::P2PSocketHostUdp(IPC::Sender* message_sender, |
34 int routing_id, int id) | 34 int routing_id, int id) |
35 : P2PSocketHost(message_sender, routing_id, id), | 35 : P2PSocketHost(message_sender, routing_id, id), |
36 socket_(new net::UDPServerSocket(NULL, net::NetLog::Source())), | 36 socket_(new net::UDPServerSocket(NULL, net::NetLog::Source())), |
37 send_queue_bytes_(0), | 37 send_queue_bytes_(0), |
38 send_pending_(false) { | 38 send_pending_(false) { |
39 } | 39 } |
40 | 40 |
41 P2PSocketHostUdp::~P2PSocketHostUdp() { | 41 P2PSocketHostUdp::~P2PSocketHostUdp() { |
42 if (state_ == STATE_OPEN) { | 42 if (state_ == STATE_OPEN) { |
43 DCHECK(socket_.get()); | 43 DCHECK(socket_.get()); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 193 } |
194 | 194 |
195 P2PSocketHost* P2PSocketHostUdp::AcceptIncomingTcpConnection( | 195 P2PSocketHost* P2PSocketHostUdp::AcceptIncomingTcpConnection( |
196 const net::IPEndPoint& remote_address, int id) { | 196 const net::IPEndPoint& remote_address, int id) { |
197 NOTREACHED(); | 197 NOTREACHED(); |
198 OnError(); | 198 OnError(); |
199 return NULL; | 199 return NULL; |
200 } | 200 } |
201 | 201 |
202 } // namespace content | 202 } // namespace content |
OLD | NEW |