summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-09-23 14:40:44 +0100
committerCarl Hetherington <cth@carlh.net>2012-09-23 14:40:44 +0100
commit1fb3be8977e2300fd0ba30d6593bcb806e66cb9a (patch)
tree8d783c57efc7951bb9445731b9c66e290bcb1993 /src/lib
parentce799a03297e4961dc203ceae0dcc41d80a44aa8 (diff)
Fix up basic test to work.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index deab5d639..3f48d696b 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -486,7 +486,7 @@ void
DeadlineWrapper::write (uint8_t const * data, int size, int timeout)
{
assert (_socket);
-
+
_deadline.expires_from_now (posix_time::seconds (timeout));
system::error_code ec = asio::error::would_block;
@@ -515,8 +515,10 @@ DeadlineWrapper::read (uint8_t* data, int size, int timeout)
(lambda::var(ec) = lambda::_1, lambda::var(amount_read) = lambda::_2)
);
- _io_service.run ();
-
+ do {
+ _io_service.run_one ();
+ } while (ec == asio::error::would_block);
+
if (ec) {
amount_read = 0;
}