From 1fb3be8977e2300fd0ba30d6593bcb806e66cb9a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 23 Sep 2012 14:40:44 +0100 Subject: Fix up basic test to work. --- src/lib/util.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3