summaryrefslogtreecommitdiff
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
parentce799a03297e4961dc203ceae0dcc41d80a44aa8 (diff)
Fix up basic test to work.
-rw-r--r--src/lib/util.cc8
-rw-r--r--test/test.cc2
2 files changed, 6 insertions, 4 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;
}
diff --git a/test/test.cc b/test/test.cc
index 06954822d..6d5efa455 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -289,7 +289,7 @@ BOOST_AUTO_TEST_CASE (client_server_test)
Config::instance()->set_server_port (61920);
Server server (&log);
- thread t (boost::bind (&Server::run, &server, 1));
+ new thread (boost::bind (&Server::run, &server, 1));
ServerDescription description ("localhost", 1);
shared_ptr<EncodedData> remotely_encoded = frame.encode_remotely (&description);