Use log rather the cout in server.
[dcpomatic.git] / src / lib / util.cc
index deab5d6396af1e26e0341a0ab03abe2b6c984088..3f48d696bbe217aabef7ae7f33b3eeaabe6a3384 100644 (file)
@@ -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;
        }