X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Futil.cc;h=3f48d696bbe217aabef7ae7f33b3eeaabe6a3384;hb=f62909cfe63e6a2e238e655ea0536a5f627e0ddf;hp=deab5d6396af1e26e0341a0ab03abe2b6c984088;hpb=93c3365a547fbb7467b6c47571c5a68e17b31e0c;p=dcpomatic.git 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; }