summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-04 22:01:08 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-04 22:01:08 +0000
commitd6829250d89c5b6aa70126550a151f0c4b622e0f (patch)
treef8a5d9cb951fce9c390e7efcd542e715d0b9bd60 /net
parent510f705cfeaa21a3c3e768e27b4b566e52e052a6 (diff)
downloadchromium_src-d6829250d89c5b6aa70126550a151f0c4b622e0f.zip
chromium_src-d6829250d89c5b6aa70126550a151f0c4b622e0f.tar.gz
chromium_src-d6829250d89c5b6aa70126550a151f0c4b622e0f.tar.bz2
Make net/test/test_server correctly report timeouts.
poll() returns 0 on a timeout, and doesn't set errno in that case, so it makes no sense to use PLOG on a timeout. Also, this change prints the number of bytes already read, to help distinguish between a case where we never receive anything from the server, and a case where we do receive response but not all of it, and the rest gets stuck for some reason (buffering?). BUG=96594 Review URL: https://codereview.chromium.org/11784004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175204 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/test/local_test_server_posix.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/test/local_test_server_posix.cc b/net/test/local_test_server_posix.cc
index eda65fd..760a915 100644
--- a/net/test/local_test_server_posix.cc
+++ b/net/test/local_test_server_posix.cc
@@ -70,8 +70,12 @@ bool ReadData(int fd, ssize_t bytes_max, uint8* buffer,
int rv = HANDLE_EINTR(poll(poll_fds, 1,
remaining_time->InMilliseconds()));
- if (rv != 1) {
- PLOG(ERROR) << "poll() failed for child file descriptor";
+ if (rv == 0) {
+ LOG(ERROR) << "poll() timed out; bytes_read=" << bytes_read;
+ return false;
+ } else if (rv < 0) {
+ PLOG(ERROR) << "poll() failed for child file descriptor; bytes_read="
+ << bytes_read;
return false;
}