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

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

Issue 1696005: Add net log entries that summarize transmit and receive byte counts. (Closed)
Patch Set: More tests and address comments Created 10 years, 8 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
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // 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/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/histogram.h" 8 #include "base/histogram.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 } 609 }
610 610
611 int FtpNetworkTransaction::DoCtrlResolveHostComplete(int result) { 611 int FtpNetworkTransaction::DoCtrlResolveHostComplete(int result) {
612 if (result == OK) 612 if (result == OK)
613 next_state_ = STATE_CTRL_CONNECT; 613 next_state_ = STATE_CTRL_CONNECT;
614 return result; 614 return result;
615 } 615 }
616 616
617 int FtpNetworkTransaction::DoCtrlConnect() { 617 int FtpNetworkTransaction::DoCtrlConnect() {
618 next_state_ = STATE_CTRL_CONNECT_COMPLETE; 618 next_state_ = STATE_CTRL_CONNECT_COMPLETE;
619 ctrl_socket_.reset(socket_factory_->CreateTCPClientSocket(addresses_)); 619 ctrl_socket_.reset(socket_factory_->CreateTCPClientSocket(
620 return ctrl_socket_->Connect(&io_callback_, net_log_); 620 addresses_, net_log_.net_log()));
621 return ctrl_socket_->Connect(&io_callback_);
621 } 622 }
622 623
623 int FtpNetworkTransaction::DoCtrlConnectComplete(int result) { 624 int FtpNetworkTransaction::DoCtrlConnectComplete(int result) {
624 if (result == OK) 625 if (result == OK)
625 next_state_ = STATE_CTRL_READ; 626 next_state_ = STATE_CTRL_READ;
626 return result; 627 return result;
627 } 628 }
628 629
629 int FtpNetworkTransaction::DoCtrlRead() { 630 int FtpNetworkTransaction::DoCtrlRead() {
630 next_state_ = STATE_CTRL_READ_COMPLETE; 631 next_state_ = STATE_CTRL_READ_COMPLETE;
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 1221
1221 int FtpNetworkTransaction::DoDataConnect() { 1222 int FtpNetworkTransaction::DoDataConnect() {
1222 next_state_ = STATE_DATA_CONNECT_COMPLETE; 1223 next_state_ = STATE_DATA_CONNECT_COMPLETE;
1223 AddressList data_address; 1224 AddressList data_address;
1224 // Connect to the same host as the control socket to prevent PASV port 1225 // Connect to the same host as the control socket to prevent PASV port
1225 // scanning attacks. 1226 // scanning attacks.
1226 int rv = ctrl_socket_->GetPeerAddress(&data_address); 1227 int rv = ctrl_socket_->GetPeerAddress(&data_address);
1227 if (rv != OK) 1228 if (rv != OK)
1228 return Stop(rv); 1229 return Stop(rv);
1229 data_address.SetPort(data_connection_port_); 1230 data_address.SetPort(data_connection_port_);
1230 data_socket_.reset(socket_factory_->CreateTCPClientSocket(data_address)); 1231 data_socket_.reset(socket_factory_->CreateTCPClientSocket(
1231 return data_socket_->Connect(&io_callback_, net_log_); 1232 data_address, net_log_.net_log()));
1233 return data_socket_->Connect(&io_callback_);
1232 } 1234 }
1233 1235
1234 int FtpNetworkTransaction::DoDataConnectComplete(int result) { 1236 int FtpNetworkTransaction::DoDataConnectComplete(int result) {
1235 RecordDataConnectionError(result); 1237 RecordDataConnectionError(result);
1236 if (resource_type_ == RESOURCE_TYPE_DIRECTORY) { 1238 if (resource_type_ == RESOURCE_TYPE_DIRECTORY) {
1237 next_state_ = STATE_CTRL_WRITE_CWD; 1239 next_state_ = STATE_CTRL_WRITE_CWD;
1238 } else { 1240 } else {
1239 next_state_ = STATE_CTRL_WRITE_SIZE; 1241 next_state_ = STATE_CTRL_WRITE_SIZE;
1240 } 1242 }
1241 return OK; 1243 return OK;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 if (!had_error_type[type]) { 1354 if (!had_error_type[type]) {
1353 had_error_type[type] = true; 1355 had_error_type[type] = true;
1354 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", 1356 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened",
1355 type, NUM_OF_NET_ERROR_TYPES); 1357 type, NUM_OF_NET_ERROR_TYPES);
1356 } 1358 }
1357 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", 1359 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount",
1358 type, NUM_OF_NET_ERROR_TYPES); 1360 type, NUM_OF_NET_ERROR_TYPES);
1359 } 1361 }
1360 1362
1361 } // namespace net 1363 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698