OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ipc/ipc_sender.h" | 9 #include "ipc/ipc_sender.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // UDP packets cannot be bigger than 64k. | 16 // UDP packets cannot be bigger than 64k. |
17 const int kReadBufferSize = 65536; | 17 const int kReadBufferSize = 65536; |
18 | 18 |
19 // Defines set of transient errors. These errors are ignored when we get them | 19 // Defines set of transient errors. These errors are ignored when we get them |
20 // from sendto() calls. | 20 // from sendto() or recvfrom() calls. |
| 21 // |
| 22 // net::ERR_OUT_OF_MEMORY |
| 23 // |
| 24 // This is caused by ENOBUFS which means the buffer of the network interface |
| 25 // is full. |
| 26 // |
| 27 // net::ERR_CONNECTION_RESET |
| 28 // |
| 29 // This is caused by WSAENETRESET or WSAECONNRESET which means the |
| 30 // last send resulted in an "ICMP Port Unreachable" message. |
21 bool IsTransientError(int error) { | 31 bool IsTransientError(int error) { |
22 return error == net::ERR_ADDRESS_UNREACHABLE || | 32 return error == net::ERR_ADDRESS_UNREACHABLE || |
23 error == net::ERR_ADDRESS_INVALID || | 33 error == net::ERR_ADDRESS_INVALID || |
24 error == net::ERR_ACCESS_DENIED; | 34 error == net::ERR_ACCESS_DENIED || |
| 35 error == net::ERR_CONNECTION_RESET || |
| 36 error == net::ERR_OUT_OF_MEMORY; |
25 } | 37 } |
26 | 38 |
27 } // namespace | 39 } // namespace |
28 | 40 |
29 namespace content { | 41 namespace content { |
30 | 42 |
31 P2PSocketHostUdp::PendingPacket::PendingPacket( | 43 P2PSocketHostUdp::PendingPacket::PendingPacket( |
32 const net::IPEndPoint& to, const std::vector<char>& content) | 44 const net::IPEndPoint& to, const std::vector<char>& content) |
33 : to(to), | 45 : to(to), |
34 data(new net::IOBuffer(content.size())), | 46 data(new net::IOBuffer(content.size())), |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 226 } |
215 | 227 |
216 P2PSocketHost* P2PSocketHostUdp::AcceptIncomingTcpConnection( | 228 P2PSocketHost* P2PSocketHostUdp::AcceptIncomingTcpConnection( |
217 const net::IPEndPoint& remote_address, int id) { | 229 const net::IPEndPoint& remote_address, int id) { |
218 NOTREACHED(); | 230 NOTREACHED(); |
219 OnError(); | 231 OnError(); |
220 return NULL; | 232 return NULL; |
221 } | 233 } |
222 | 234 |
223 } // namespace content | 235 } // namespace content |
OLD | NEW |