MCPcopy Create free account
hub / github.com/apache/brpc / CancelBeforeCallMethodParallel

Method CancelBeforeCallMethodParallel

test/brpc_channel_unittest.cpp:962–993  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

960 }
961
962 void CancelBeforeCallMethodParallel(
963 bool single_server, bool async, bool short_connection) {
964 std::cout << " *** single=" << single_server
965 << " async=" << async
966 << " short=" << short_connection << std::endl;
967
968 ASSERT_EQ(0, StartAccept(_ep));
969
970 const size_t NCHANS = 8;
971 brpc::Channel subchans[NCHANS];
972 brpc::ParallelChannel channel;
973 for (size_t i = 0; i < NCHANS; ++i) {
974 SetUpChannel(&subchans[i], single_server, short_connection);
975 ASSERT_EQ(0, channel.AddChannel(
976 &subchans[i], brpc::DOESNT_OWN_CHANNEL,
977 NULL, NULL));
978 }
979
980 brpc::Controller cntl;
981 test::EchoRequest req;
982 test::EchoResponse res;
983 req.set_message(__FUNCTION__);
984 const brpc::CallId cid = cntl.call_id();
985 ASSERT_TRUE(cid.value != 0);
986 brpc::StartCancel(cid);
987 CallMethod(&channel, &cntl, &req, &res, async);
988 EXPECT_EQ(ECANCELED, cntl.ErrorCode()) << cntl.ErrorText();
989 EXPECT_EQ(NCHANS, (size_t)cntl.sub_count());
990 EXPECT_TRUE(NULL == cntl.sub(1));
991 EXPECT_TRUE(NULL == cntl.sub(0));
992 StopAndJoin();
993 }
994
995 void CancelBeforeCallMethodSelective(
996 bool single_server, bool async, bool short_connection) {

Callers

nothing calls this directly

Calls 7

StartCancelFunction · 0.85
call_idMethod · 0.80
ErrorCodeMethod · 0.80
ErrorTextMethod · 0.80
sub_countMethod · 0.80
subMethod · 0.80
AddChannelMethod · 0.45

Tested by

no test coverage detected