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 "net/ftp/ftp_network_transaction.h" | 5 #include "net/ftp/ftp_network_transaction.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 | 1221 |
1222 int FtpNetworkTransaction::DoDataConnect() { | 1222 int FtpNetworkTransaction::DoDataConnect() { |
1223 next_state_ = STATE_DATA_CONNECT_COMPLETE; | 1223 next_state_ = STATE_DATA_CONNECT_COMPLETE; |
1224 IPEndPoint ip_endpoint; | 1224 IPEndPoint ip_endpoint; |
1225 AddressList data_address; | 1225 AddressList data_address; |
1226 // Connect to the same host as the control socket to prevent PASV port | 1226 // Connect to the same host as the control socket to prevent PASV port |
1227 // scanning attacks. | 1227 // scanning attacks. |
1228 int rv = ctrl_socket_->GetPeerAddress(&ip_endpoint); | 1228 int rv = ctrl_socket_->GetPeerAddress(&ip_endpoint); |
1229 if (rv != OK) | 1229 if (rv != OK) |
1230 return Stop(rv); | 1230 return Stop(rv); |
1231 data_address = AddressList::CreateFromIPAddress( | 1231 data_address = AddressList::CreateFromIPAddress(ip_endpoint.address().bytes(), |
1232 ip_endpoint.address(), data_connection_port_); | 1232 data_connection_port_); |
1233 data_socket_ = socket_factory_->CreateTransportClientSocket( | 1233 data_socket_ = socket_factory_->CreateTransportClientSocket( |
1234 data_address, net_log_.net_log(), net_log_.source()); | 1234 data_address, net_log_.net_log(), net_log_.source()); |
1235 net_log_.AddEvent( | 1235 net_log_.AddEvent( |
1236 NetLog::TYPE_FTP_DATA_CONNECTION, | 1236 NetLog::TYPE_FTP_DATA_CONNECTION, |
1237 data_socket_->NetLog().source().ToEventParametersCallback()); | 1237 data_socket_->NetLog().source().ToEventParametersCallback()); |
1238 return data_socket_->Connect(io_callback_); | 1238 return data_socket_->Connect(io_callback_); |
1239 } | 1239 } |
1240 | 1240 |
1241 int FtpNetworkTransaction::DoDataConnectComplete(int result) { | 1241 int FtpNetworkTransaction::DoDataConnectComplete(int result) { |
1242 if (result != OK && use_epsv_) { | 1242 if (result != OK && use_epsv_) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 if (!had_error_type[type]) { | 1372 if (!had_error_type[type]) { |
1373 had_error_type[type] = true; | 1373 had_error_type[type] = true; |
1374 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", | 1374 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", |
1375 type, NUM_OF_NET_ERROR_TYPES); | 1375 type, NUM_OF_NET_ERROR_TYPES); |
1376 } | 1376 } |
1377 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", | 1377 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", |
1378 type, NUM_OF_NET_ERROR_TYPES); | 1378 type, NUM_OF_NET_ERROR_TYPES); |
1379 } | 1379 } |
1380 | 1380 |
1381 } // namespace net | 1381 } // namespace net |
OLD | NEW |