Chromium Code Reviews| 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 "net/udp/udp_client_socket.h" | 5 #include "net/udp/udp_client_socket.h" |
| 6 | 6 |
| 7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
| 8 #include "net/log/net_log.h" | 8 #include "net/log/net_log.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 UDPClientSocket::UDPClientSocket(DatagramSocket::BindType bind_type, | 12 UDPClientSocket::UDPClientSocket(DatagramSocket::BindType bind_type, |
| 13 const RandIntCallback& rand_int_cb, | 13 const RandIntCallback& rand_int_cb, |
| 14 net::NetLog* net_log, | 14 net::NetLog* net_log, |
| 15 const net::NetLog::Source& source) | 15 const net::NetLog::Source& source) |
| 16 : socket_(bind_type, rand_int_cb, net_log, source) { | 16 : socket_(bind_type, rand_int_cb, net_log, source) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 UDPClientSocket::~UDPClientSocket() { | 19 UDPClientSocket::~UDPClientSocket() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 int UDPClientSocket::BindToNetwork( | 22 int UDPClientSocket::BindToNetwork( |
| 23 NetworkChangeNotifier::NetworkHandle network) { | 23 NetworkChangeNotifier::NetworkHandle network) { |
| 24 return socket_.BindToNetwork(network); | 24 return socket_.BindToNetwork(network); |
| 25 } | 25 } |
| 26 | 26 |
| 27 int UDPClientSocket::BindToDefaultNetwork() { | |
| 28 NetworkChangeNotifier::NetworkHandle network = | |
| 29 NetworkChangeNotifier::GetDefaultNetwork(); | |
| 30 return BindToNetwork(network); | |
|
pauljensen
2015/10/19 19:01:39
The reason this needs to loop is that the default
pauljensen
2015/10/19 19:49:04
This incorrectly returns ERR_INTERNET_DISCONNECTED
Jana
2015/11/17 01:50:09
Let's continue this conversation on your CL to imp
| |
| 31 } | |
| 32 | |
| 27 int UDPClientSocket::Connect(const IPEndPoint& address) { | 33 int UDPClientSocket::Connect(const IPEndPoint& address) { |
| 28 int rv = socket_.Open(address.GetFamily()); | 34 int rv = socket_.Open(address.GetFamily()); |
| 29 if (rv != OK) | 35 if (rv != OK) |
| 30 return rv; | 36 return rv; |
| 31 return socket_.Connect(address); | 37 return socket_.Connect(address); |
| 32 } | 38 } |
| 33 | 39 |
| 34 int UDPClientSocket::Read(IOBuffer* buf, | 40 int UDPClientSocket::Read(IOBuffer* buf, |
| 35 int buf_len, | 41 int buf_len, |
| 36 const CompletionCallback& callback) { | 42 const CompletionCallback& callback) { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 67 return socket_.NetLog(); | 73 return socket_.NetLog(); |
| 68 } | 74 } |
| 69 | 75 |
| 70 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
| 71 void UDPClientSocket::UseNonBlockingIO() { | 77 void UDPClientSocket::UseNonBlockingIO() { |
| 72 socket_.UseNonBlockingIO(); | 78 socket_.UseNonBlockingIO(); |
| 73 } | 79 } |
| 74 #endif | 80 #endif |
| 75 | 81 |
| 76 } // namespace net | 82 } // namespace net |
| OLD | NEW |