Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: net/ftp/ftp_network_transaction.cc

Issue 1376473003: Notify NQE of TCP RTT values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 647
648 int FtpNetworkTransaction::DoCtrlResolveHostComplete(int result) { 648 int FtpNetworkTransaction::DoCtrlResolveHostComplete(int result) {
649 if (result == OK) 649 if (result == OK)
650 next_state_ = STATE_CTRL_CONNECT; 650 next_state_ = STATE_CTRL_CONNECT;
651 return result; 651 return result;
652 } 652 }
653 653
654 int FtpNetworkTransaction::DoCtrlConnect() { 654 int FtpNetworkTransaction::DoCtrlConnect() {
655 next_state_ = STATE_CTRL_CONNECT_COMPLETE; 655 next_state_ = STATE_CTRL_CONNECT_COMPLETE;
656 ctrl_socket_ = socket_factory_->CreateTransportClientSocket( 656 ctrl_socket_ = socket_factory_->CreateTransportClientSocket(
657 addresses_, net_log_.net_log(), net_log_.source()); 657 addresses_, /*socket_performance_watcher_factory=*/nullptr,
658 net_log_.net_log(), net_log_.source());
658 net_log_.AddEvent( 659 net_log_.AddEvent(
659 NetLog::TYPE_FTP_CONTROL_CONNECTION, 660 NetLog::TYPE_FTP_CONTROL_CONNECTION,
660 ctrl_socket_->NetLog().source().ToEventParametersCallback()); 661 ctrl_socket_->NetLog().source().ToEventParametersCallback());
661 return ctrl_socket_->Connect(io_callback_); 662 return ctrl_socket_->Connect(io_callback_);
662 } 663 }
663 664
664 int FtpNetworkTransaction::DoCtrlConnectComplete(int result) { 665 int FtpNetworkTransaction::DoCtrlConnectComplete(int result) {
665 if (result == OK) { 666 if (result == OK) {
666 // Put the peer's IP address and port into the response. 667 // Put the peer's IP address and port into the response.
667 IPEndPoint ip_endpoint; 668 IPEndPoint ip_endpoint;
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 IPEndPoint ip_endpoint; 1225 IPEndPoint ip_endpoint;
1225 AddressList data_address; 1226 AddressList data_address;
1226 // Connect to the same host as the control socket to prevent PASV port 1227 // Connect to the same host as the control socket to prevent PASV port
1227 // scanning attacks. 1228 // scanning attacks.
1228 int rv = ctrl_socket_->GetPeerAddress(&ip_endpoint); 1229 int rv = ctrl_socket_->GetPeerAddress(&ip_endpoint);
1229 if (rv != OK) 1230 if (rv != OK)
1230 return Stop(rv); 1231 return Stop(rv);
1231 data_address = AddressList::CreateFromIPAddress( 1232 data_address = AddressList::CreateFromIPAddress(
1232 ip_endpoint.address(), data_connection_port_); 1233 ip_endpoint.address(), data_connection_port_);
1233 data_socket_ = socket_factory_->CreateTransportClientSocket( 1234 data_socket_ = socket_factory_->CreateTransportClientSocket(
1234 data_address, net_log_.net_log(), net_log_.source()); 1235 data_address, /*socket_performance_watcher_factory_=*/nullptr,
1236 net_log_.net_log(), net_log_.source());
1235 net_log_.AddEvent( 1237 net_log_.AddEvent(
1236 NetLog::TYPE_FTP_DATA_CONNECTION, 1238 NetLog::TYPE_FTP_DATA_CONNECTION,
1237 data_socket_->NetLog().source().ToEventParametersCallback()); 1239 data_socket_->NetLog().source().ToEventParametersCallback());
1238 return data_socket_->Connect(io_callback_); 1240 return data_socket_->Connect(io_callback_);
1239 } 1241 }
1240 1242
1241 int FtpNetworkTransaction::DoDataConnectComplete(int result) { 1243 int FtpNetworkTransaction::DoDataConnectComplete(int result) {
1242 if (result != OK && use_epsv_) { 1244 if (result != OK && use_epsv_) {
1243 // It's possible we hit a broken server, sadly. They can break in different 1245 // It's possible we hit a broken server, sadly. They can break in different
1244 // ways. Some time out, some reset a connection. Fall back to PASV. 1246 // ways. Some time out, some reset a connection. Fall back to PASV.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 if (!had_error_type[type]) { 1374 if (!had_error_type[type]) {
1373 had_error_type[type] = true; 1375 had_error_type[type] = true;
1374 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", 1376 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened",
1375 type, NUM_OF_NET_ERROR_TYPES); 1377 type, NUM_OF_NET_ERROR_TYPES);
1376 } 1378 }
1377 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", 1379 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount",
1378 type, NUM_OF_NET_ERROR_TYPES); 1380 type, NUM_OF_NET_ERROR_TYPES);
1379 } 1381 }
1380 1382
1381 } // namespace net 1383 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698