diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-24 04:01:09 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-24 04:01:09 +0000 |
commit | bb9cf4ffac0116e7cc117a5c2916367544bc3aaf (patch) | |
tree | e64cee66b6dfa8469ab7dcd3e0413f3c1ed8eabb /libpqpp | |
parent | PostgreSQL files prefixed with pq- (diff) | |
download | libdbpp-postgresql-bb9cf4ffac0116e7cc117a5c2916367544bc3aaf.tar.bz2 libdbpp-postgresql-bb9cf4ffac0116e7cc117a5c2916367544bc3aaf.tar.xz libdbpp-postgresql-bb9cf4ffac0116e7cc117a5c2916367544bc3aaf.zip |
Remove 1ms sleep from ping, do the sleep in the test
Diffstat (limited to 'libpqpp')
-rw-r--r-- | libpqpp/pq-connection.cpp | 2 | ||||
-rw-r--r-- | libpqpp/unittests/testpq.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/libpqpp/pq-connection.cpp b/libpqpp/pq-connection.cpp index db46dc5..74fce9e 100644 --- a/libpqpp/pq-connection.cpp +++ b/libpqpp/pq-connection.cpp @@ -110,7 +110,7 @@ void PQ::Connection::ping() const { struct pollfd fd { PQsocket(conn), POLLRDHUP | POLLERR | POLLHUP | POLLNVAL, 0 }; - if (PQstatus(conn) != CONNECTION_OK || poll(&fd, 1, 1)) { + if (PQstatus(conn) != CONNECTION_OK || poll(&fd, 1, 0)) { if (inTx()) { throw ConnectionError(conn); } diff --git a/libpqpp/unittests/testpq.cpp b/libpqpp/unittests/testpq.cpp index b321075..2ff3235 100644 --- a/libpqpp/unittests/testpq.cpp +++ b/libpqpp/unittests/testpq.cpp @@ -181,6 +181,7 @@ BOOST_AUTO_TEST_CASE( reconnect ) kil->bindParamI(0, pid1); kil->execute(); delete kil; + usleep(5000); ro->ping(); int pid2 = PQbackendPID(pqconn->conn); BOOST_REQUIRE(pid2); @@ -202,6 +203,7 @@ BOOST_AUTO_TEST_CASE( reconnectInTx ) kil->bindParamI(0, pid1); kil->execute(); delete kil; + usleep(5000); BOOST_REQUIRE_THROW(ro->ping(), PQ::ConnectionError); delete ro; delete rok; |