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 "remoting/client/plugin/pepper_packet_socket_factory.h" | 5 #include "remoting/client/plugin/pepper_packet_socket_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "ppapi/cpp/net_address.h" | 10 #include "ppapi/cpp/net_address.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 const int kMaxSendBufferSize = 256 * 1024; | 27 const int kMaxSendBufferSize = 256 * 1024; |
28 | 28 |
29 // Enum for different actions that can be taken after sendto() returns an error. | 29 // Enum for different actions that can be taken after sendto() returns an error. |
30 enum ErrorAction { | 30 enum ErrorAction { |
31 ERROR_ACTION_FAIL, | 31 ERROR_ACTION_FAIL, |
32 ERROR_ACTION_IGNORE, | 32 ERROR_ACTION_IGNORE, |
33 ERROR_ACTION_RETRY, | 33 ERROR_ACTION_RETRY, |
34 }; | 34 }; |
35 | 35 |
36 // Returns ErrorAction to perform if sendto() fails with |error|. | 36 // Returns ErrorAction to perform if sendto() fails with |error|. |
37 // | |
38 // Keep this logic in sync with GetErrorAction() in | |
39 // remoting/jingle_glue/chromium_socket_factory.cc . | |
Wez
2014/06/17 03:27:54
Could we convert the PPAPI error code to a net err
Sergey Ulanov
2014/06/17 22:32:04
Done.
| |
37 ErrorAction GetErrorAction(int error) { | 40 ErrorAction GetErrorAction(int error) { |
38 switch (error) { | 41 switch (error) { |
39 // UDP is connectionless, so we may receive ICMP unreachable or reset errors | 42 // UDP is connectionless, so we may receive ICMP unreachable or reset errors |
40 // for previous sends to different addresses. | 43 // for previous sends to different addresses. |
41 case PP_ERROR_ADDRESS_UNREACHABLE: | 44 case PP_ERROR_ADDRESS_UNREACHABLE: |
42 case PP_ERROR_CONNECTION_RESET: | 45 case PP_ERROR_CONNECTION_RESET: |
43 return ERROR_ACTION_RETRY; | 46 return ERROR_ACTION_RETRY; |
44 | 47 |
45 // Target address is invalid. The socket is still usable for different | 48 // Target address is invalid. The socket is still usable for different |
46 // target addresses and the error can be ignored. | 49 // target addresses and the error can be ignored. |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 return NULL; | 420 return NULL; |
418 } | 421 } |
419 | 422 |
420 talk_base::AsyncResolverInterface* | 423 talk_base::AsyncResolverInterface* |
421 PepperPacketSocketFactory::CreateAsyncResolver() { | 424 PepperPacketSocketFactory::CreateAsyncResolver() { |
422 NOTREACHED(); | 425 NOTREACHED(); |
423 return NULL; | 426 return NULL; |
424 } | 427 } |
425 | 428 |
426 } // namespace remoting | 429 } // namespace remoting |
OLD | NEW |