| 432 | TServerIntegrationProcessorTestFixture<TThreadedServer>) |
| 433 | |
| 434 | BOOST_AUTO_TEST_CASE(test_stop_with_interruptable_clients_connected) { |
| 435 | // This tests THRIFT-2441 new behavior: stopping the server disconnects clients |
| 436 | BOOST_TEST_MESSAGE("Testing stop with interruptable clients"); |
| 437 | |
| 438 | startServer(); |
| 439 | |
| 440 | shared_ptr<TSocket> pClientSock1(new TSocket("localhost", getServerPort()), |
| 441 | autoSocketCloser); |
| 442 | pClientSock1->open(); |
| 443 | |
| 444 | shared_ptr<TSocket> pClientSock2(new TSocket("localhost", getServerPort()), |
| 445 | autoSocketCloser); |
| 446 | pClientSock2->open(); |
| 447 | |
| 448 | // Ensure they have been accepted |
| 449 | blockUntilAccepted(2); |
| 450 | |
| 451 | // The test fixture destructor will force the sockets to disconnect |
| 452 | // Prior to THRIFT-2441, pServer->stop() would hang until clients disconnected |
| 453 | stopServer(); |
| 454 | |
| 455 | // extra proof the server end disconnected the clients |
| 456 | uint8_t buf[1]; |
| 457 | BOOST_CHECK_EQUAL(0, pClientSock1->read(&buf[0], 1)); // 0 = disconnected |
| 458 | BOOST_CHECK_EQUAL(0, pClientSock2->read(&buf[0], 1)); // 0 = disconnected |
| 459 | } |
| 460 | |
| 461 | BOOST_AUTO_TEST_CASE(test_stop_with_uninterruptable_clients_connected) { |
| 462 | // This tests pre-THRIFT-2441 behavior: stopping the server blocks until clients |
nothing calls this directly
no test coverage detected