| 1702 | } |
| 1703 | |
| 1704 | void TestDestroyChannel(bool single_server, bool short_connection) { |
| 1705 | std::cout << "*** single=" << single_server |
| 1706 | << ", short=" << short_connection << std::endl; |
| 1707 | |
| 1708 | ASSERT_EQ(0, StartAccept(_ep)); |
| 1709 | brpc::Channel* channel = new brpc::Channel(); |
| 1710 | SetUpChannel(channel, single_server, short_connection); |
| 1711 | |
| 1712 | brpc::Controller cntl; |
| 1713 | test::EchoRequest req; |
| 1714 | test::EchoResponse res; |
| 1715 | req.set_message(__FUNCTION__); |
| 1716 | req.set_sleep_us(10000); |
| 1717 | CallMethod(channel, &cntl, &req, &res, true, true/*destroy*/); |
| 1718 | |
| 1719 | EXPECT_EQ(0, cntl.ErrorCode()) << cntl.ErrorText(); |
| 1720 | EXPECT_EQ("received " + std::string(__FUNCTION__), res.message()); |
| 1721 | // Sleep to let `_messenger' detect `Socket' being `SetFailed' |
| 1722 | const int64_t start_time = butil::cpuwide_time_us(); |
| 1723 | while (_messenger.ConnectionCount() != 0) { |
| 1724 | EXPECT_LT(butil::cpuwide_time_us(), start_time + 100000L/*100ms*/); |
| 1725 | bthread_usleep(1000); |
| 1726 | } |
| 1727 | |
| 1728 | StopAndJoin(); |
| 1729 | } |
| 1730 | |
| 1731 | void TestDestroyChannelParallel(bool single_server, bool short_connection) { |
| 1732 | std::cout << "*** single=" << single_server |
nothing calls this directly
no test coverage detected