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

Unified Diff: remoting/host/gnubby_socket.cc

Issue 1234003002: Fix GnubbyAuthHandlerPosix to handle requests correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@allowIo
Patch Set: Rebase Created 5 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 | « remoting/host/gnubby_auth_handler_posix_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/gnubby_socket.cc
diff --git a/remoting/host/gnubby_socket.cc b/remoting/host/gnubby_socket.cc
index 7df45148a96a0ebc799f1de1cb68ee0b099f9c42..21dad8152f25e479d8919b49775618adeb8c3226 100644
--- a/remoting/host/gnubby_socket.cc
+++ b/remoting/host/gnubby_socket.cc
@@ -4,6 +4,7 @@
#include "remoting/host/gnubby_socket.h"
+#include "base/callback_helpers.h"
#include "base/macros.h"
#include "base/timer/timer.h"
#include "net/base/io_buffer.h"
@@ -72,6 +73,7 @@ void GnubbySocket::SendSshError() {
void GnubbySocket::StartReadingRequest(
const base::Closure& request_received_callback) {
DCHECK(CalledOnValidThread());
+ DCHECK(request_received_callback_.is_null());
request_received_callback_ = request_received_callback;
DoRead();
@@ -82,7 +84,7 @@ void GnubbySocket::OnDataWritten(int result) {
DCHECK(write_buffer_);
if (result < 0) {
- LOG(ERROR) << "Error in sending response.";
+ LOG(ERROR) << "Error sending response: " << result;
return;
}
ResetTimer();
@@ -105,23 +107,26 @@ void GnubbySocket::DoWrite() {
OnDataWritten(result);
}
-void GnubbySocket::OnDataRead(int bytes_read) {
+void GnubbySocket::OnDataRead(int result) {
DCHECK(CalledOnValidThread());
- if (bytes_read < 0) {
- LOG(ERROR) << "Error in reading request.";
+ if (result <= 0) {
+ if (result < 0)
+ LOG(ERROR) << "Error reading request: " << result;
read_completed_ = true;
- request_received_callback_.Run();
+ base::ResetAndReturn(&request_received_callback_).Run();
return;
}
+
ResetTimer();
request_data_.insert(request_data_.end(), read_buffer_->data(),
- read_buffer_->data() + bytes_read);
+ read_buffer_->data() + result);
if (IsRequestComplete()) {
read_completed_ = true;
- request_received_callback_.Run();
+ base::ResetAndReturn(&request_received_callback_).Run();
return;
}
+
DoRead();
}
« no previous file with comments | « remoting/host/gnubby_auth_handler_posix_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698