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

Method CancelBeforeCallMethodSelective

test/brpc_channel_unittest.cpp:995–1022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

993 }
994
995 void CancelBeforeCallMethodSelective(
996 bool single_server, bool async, bool short_connection) {
997 std::cout << " *** single=" << single_server
998 << " async=" << async
999 << " short=" << short_connection << std::endl;
1000
1001 ASSERT_EQ(0, StartAccept(_ep));
1002
1003 const size_t NCHANS = 8;
1004 brpc::SelectiveChannel channel;
1005 ASSERT_EQ(0, channel.Init("rr", NULL));
1006 for (size_t i = 0; i < NCHANS; ++i) {
1007 brpc::Channel* subchan = new brpc::Channel;
1008 SetUpChannel(subchan, single_server, short_connection);
1009 ASSERT_EQ(0, channel.AddChannel(subchan, NULL)) << "i=" << i;
1010 }
1011
1012 brpc::Controller cntl;
1013 test::EchoRequest req;
1014 test::EchoResponse res;
1015 req.set_message(__FUNCTION__);
1016 const brpc::CallId cid = cntl.call_id();
1017 ASSERT_TRUE(cid.value != 0);
1018 brpc::StartCancel(cid);
1019 CallMethod(&channel, &cntl, &req, &res, async);
1020 EXPECT_EQ(ECANCELED, cntl.ErrorCode()) << cntl.ErrorText();
1021 StopAndJoin();
1022 }
1023
1024 void CancelDuringCallMethod(
1025 bool single_server, bool async, bool short_connection) {

Callers

nothing calls this directly

Calls 6

StartCancelFunction · 0.85
call_idMethod · 0.80
ErrorCodeMethod · 0.80
ErrorTextMethod · 0.80
InitMethod · 0.45
AddChannelMethod · 0.45

Tested by

no test coverage detected