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

Unified Diff: net/ftp/ftp_network_transaction.cc

Issue 159663: Fix a hang if directory listing size is > 8K, for example,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Upload before checkin Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/url_request/url_request_new_ftp_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_network_transaction.cc
===================================================================
--- net/ftp/ftp_network_transaction.cc (revision 22214)
+++ net/ftp/ftp_network_transaction.cc (working copy)
@@ -83,24 +83,15 @@
int buf_len,
CompletionCallback* callback) {
DCHECK(buf);
- DCHECK(buf_len > 0);
+ DCHECK_GT(buf_len, 0);
- if (data_socket_ == NULL)
- return 0; // Data socket closed, no more data left.
-
- if (!data_socket_->IsConnected())
- return 0; // Data socket disconnected, no more data left.
-
read_data_buf_ = buf;
read_data_buf_len_ = buf_len;
next_state_ = STATE_DATA_READ;
-
int rv = DoLoop(OK);
if (rv == ERR_IO_PENDING)
user_callback_ = callback;
- else if (rv == 0)
- data_socket_->Disconnect();
return rv;
}
@@ -836,7 +827,7 @@
const FtpCtrlResponse& response) {
switch (GetErrorClass(response.status_code)) {
case ERROR_CLASS_INITIATED:
- next_state_ = STATE_CTRL_READ;
+ response_.is_directory_listing = true;
break;
case ERROR_CLASS_OK:
response_.is_directory_listing = true;
@@ -907,8 +898,13 @@
int FtpNetworkTransaction::DoDataRead() {
DCHECK(read_data_buf_);
- DCHECK(read_data_buf_len_ > 0);
+ DCHECK_GT(read_data_buf_len_, 0);
+ if (data_socket_ == NULL || !data_socket_->IsConnected()) {
+ // No more data so send QUIT Command now and wait for response.
+ return Stop(OK);
+ }
+
next_state_ = STATE_DATA_READ_COMPLETE;
read_data_buf_->data()[0] = 0;
return data_socket_->Read(read_data_buf_, read_data_buf_len_,
« no previous file with comments | « no previous file | net/url_request/url_request_new_ftp_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698