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.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 676 |
677 int FtpNetworkTransaction::DoCtrlConnectComplete(int result) { | 677 int FtpNetworkTransaction::DoCtrlConnectComplete(int result) { |
678 if (result == OK) { | 678 if (result == OK) { |
679 // Put the peer's IP address and port into the response. | 679 // Put the peer's IP address and port into the response. |
680 IPEndPoint ip_endpoint; | 680 IPEndPoint ip_endpoint; |
681 result = ctrl_socket_->GetPeerAddress(&ip_endpoint); | 681 result = ctrl_socket_->GetPeerAddress(&ip_endpoint); |
682 if (result == OK) { | 682 if (result == OK) { |
683 response_.socket_address = HostPortPair::FromIPEndPoint(ip_endpoint); | 683 response_.socket_address = HostPortPair::FromIPEndPoint(ip_endpoint); |
684 next_state_ = STATE_CTRL_READ; | 684 next_state_ = STATE_CTRL_READ; |
685 | 685 |
686 if (ip_endpoint.GetFamily() == AF_INET) { | 686 if (ip_endpoint.GetFamily() == ADDRESS_FAMILY_IPV4) { |
687 // Do not use EPSV for IPv4 connections. Some servers become confused | 687 // Do not use EPSV for IPv4 connections. Some servers become confused |
688 // and we time out while waiting to connect. PASV is perfectly fine for | 688 // and we time out while waiting to connect. PASV is perfectly fine for |
689 // IPv4. Note that this blacklists IPv4 not to use EPSV instead of | 689 // IPv4. Note that this blacklists IPv4 not to use EPSV instead of |
690 // whitelisting IPv6 to use it, to make the code more future-proof: | 690 // whitelisting IPv6 to use it, to make the code more future-proof: |
691 // all future protocols should just use EPSV. | 691 // all future protocols should just use EPSV. |
692 use_epsv_ = false; | 692 use_epsv_ = false; |
693 } | 693 } |
694 } | 694 } |
695 } | 695 } |
696 return result; | 696 return result; |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 if (!had_error_type[type]) { | 1387 if (!had_error_type[type]) { |
1388 had_error_type[type] = true; | 1388 had_error_type[type] = true; |
1389 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", | 1389 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", |
1390 type, NUM_OF_NET_ERROR_TYPES); | 1390 type, NUM_OF_NET_ERROR_TYPES); |
1391 } | 1391 } |
1392 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", | 1392 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", |
1393 type, NUM_OF_NET_ERROR_TYPES); | 1393 type, NUM_OF_NET_ERROR_TYPES); |
1394 } | 1394 } |
1395 | 1395 |
1396 } // namespace net | 1396 } // namespace net |
OLD | NEW |