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

Unified Diff: tools/android/forwarder2/command.cc

Issue 11269036: Support HTTP test-server based net unit tests on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Clang build + sync Created 8 years, 1 month 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
Index: tools/android/forwarder2/command.cc
diff --git a/tools/android/forwarder2/command.cc b/tools/android/forwarder2/command.cc
index 9b9e401ce365318a8b29e4dbebe764ec18218d19..c070ed9adacd31de7ea8875100e0bd6c6766ba2d 100644
--- a/tools/android/forwarder2/command.cc
+++ b/tools/android/forwarder2/command.cc
@@ -10,6 +10,7 @@
#include <string.h>
#include "base/logging.h"
+#include "base/safe_strerror_posix.h"
#include "base/string_number_conversions.h"
#include "base/string_piece.h"
#include "tools/android/forwarder2/socket.h"
@@ -46,9 +47,14 @@ bool ReadCommand(Socket* socket,
// To make logging easier.
command_buffer[kCommandStringSize] = '\0';
- if (socket->ReadNumBytes(command_buffer, kCommandStringSize) !=
- kCommandStringSize) {
- LOG(ERROR) << "Not enough data received from the socket.";
+ int bytes_read = socket->ReadNumBytes(command_buffer, kCommandStringSize);
+ if (bytes_read != kCommandStringSize) {
+ if (bytes_read < 0)
+ LOG(ERROR) << "Read() error: " << safe_strerror(errno);
+ else if (!bytes_read)
+ LOG(ERROR) << "Read() error, endpoint was unexpectedly closed.";
+ else
+ LOG(ERROR) << "Read() error, not enough data received from the socket.";
return false;
}

Powered by Google App Engine
This is Rietveld 408576698