MCPcopy Create free account
hub / github.com/apache/thrift / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

lib/cpp/test/TSocketInterruptTest.cpp:53–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53BOOST_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
72BOOST_AUTO_TEST_CASE(test_non_interruptable_child_read) {
73 TServerSocket sock1("localhost", 0);

Callers

nothing calls this directly

Calls 10

acceptMethod · 0.65
closeMethod · 0.65
bindFunction · 0.50
listenMethod · 0.45
isOpenMethod · 0.45
getPortMethod · 0.45
openMethod · 0.45
interruptChildrenMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected