| 1729 | } |
| 1730 | |
| 1731 | void TestDestroyChannelParallel(bool single_server, bool short_connection) { |
| 1732 | std::cout << "*** single=" << single_server |
| 1733 | << ", short=" << short_connection << std::endl; |
| 1734 | |
| 1735 | const size_t NCHANS = 5; |
| 1736 | ASSERT_EQ(0, StartAccept(_ep)); |
| 1737 | brpc::ParallelChannel* channel = new brpc::ParallelChannel; |
| 1738 | for (size_t i = 0; i < NCHANS; ++i) { |
| 1739 | brpc::Channel* subchan = new brpc::Channel(); |
| 1740 | SetUpChannel(subchan, single_server, short_connection); |
| 1741 | ASSERT_EQ(0, channel->AddChannel( |
| 1742 | subchan, brpc::OWNS_CHANNEL, NULL, NULL)); |
| 1743 | } |
| 1744 | |
| 1745 | brpc::Controller cntl; |
| 1746 | test::EchoRequest req; |
| 1747 | test::EchoResponse res; |
| 1748 | req.set_sleep_us(10000); |
| 1749 | req.set_message(__FUNCTION__); |
| 1750 | CallMethod(channel, &cntl, &req, &res, true, true/*destroy*/); |
| 1751 | |
| 1752 | EXPECT_EQ(0, cntl.ErrorCode()) << cntl.ErrorText(); |
| 1753 | EXPECT_EQ("received " + std::string(__FUNCTION__), res.message()); |
| 1754 | // Sleep to let `_messenger' detect `Socket' being `SetFailed' |
| 1755 | const int64_t start_time = butil::cpuwide_time_us(); |
| 1756 | while (_messenger.ConnectionCount() != 0) { |
| 1757 | EXPECT_LT(butil::cpuwide_time_us(), start_time + 100000L/*100ms*/); |
| 1758 | bthread_usleep(1000); |
| 1759 | } |
| 1760 | StopAndJoin(); |
| 1761 | } |
| 1762 | |
| 1763 | void TestDestroyChannelSelective(bool single_server, bool short_connection) { |
| 1764 | std::cout << "*** single=" << single_server |
nothing calls this directly
no test coverage detected