| 51 | } |
| 52 | |
| 53 | BOOST_AUTO_TEST_CASE(test_interruptable_child_read) { |
| 54 | TServerSocket sock1("localhost", 0); |
| 55 | sock1.listen(); |
| 56 | BOOST_CHECK(sock1.isOpen()); |
| 57 | int port = sock1.getPort(); |
| 58 | TSocket clientSock("localhost", port); |
| 59 | clientSock.open(); |
| 60 | std::shared_ptr<TTransport> accepted = sock1.accept(); |
| 61 | boost::thread readThread(std::bind(readerWorkerMustThrow, accepted)); |
| 62 | boost::this_thread::sleep(boost::posix_time::milliseconds(50)); |
| 63 | // readThread is practically guaranteed to be blocking now |
| 64 | sock1.interruptChildren(); |
| 65 | BOOST_CHECK_MESSAGE(readThread.try_join_for(boost::chrono::milliseconds(200)), |
| 66 | "server socket interruptChildren did not interrupt child read"); |
| 67 | clientSock.close(); |
| 68 | accepted->close(); |
| 69 | sock1.close(); |
| 70 | } |
| 71 | |
| 72 | BOOST_AUTO_TEST_CASE(test_non_interruptable_child_read) { |
| 73 | TServerSocket sock1("localhost", 0); |
nothing calls this directly
no test coverage detected