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

Method CancelAfterCallMethodParallel

test/brpc_channel_unittest.cpp:1162–1194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1160 }
1161
1162 void CancelAfterCallMethodParallel(
1163 bool single_server, bool async, bool short_connection) {
1164 std::cout << " *** single=" << single_server
1165 << " async=" << async
1166 << " short=" << short_connection << std::endl;
1167
1168 ASSERT_EQ(0, StartAccept(_ep));
1169
1170 const size_t NCHANS = 8;
1171 brpc::Channel subchans[NCHANS];
1172 brpc::ParallelChannel channel;
1173 for (size_t i = 0; i < NCHANS; ++i) {
1174 SetUpChannel(&subchans[i], single_server, short_connection);
1175 ASSERT_EQ(0, channel.AddChannel(
1176 &subchans[i], brpc::DOESNT_OWN_CHANNEL,
1177 NULL, NULL));
1178 }
1179
1180 brpc::Controller cntl;
1181 test::EchoRequest req;
1182 test::EchoResponse res;
1183 req.set_message(__FUNCTION__);
1184 const brpc::CallId cid = cntl.call_id();
1185 ASSERT_TRUE(cid.value != 0);
1186 CallMethod(&channel, &cntl, &req, &res, async);
1187 EXPECT_EQ(0, cntl.ErrorCode());
1188 EXPECT_EQ(NCHANS, (size_t)cntl.sub_count());
1189 for (int i = 0; i < cntl.sub_count(); ++i) {
1190 EXPECT_TRUE(cntl.sub(i) && !cntl.sub(i)->Failed()) << "i=" << i;
1191 }
1192 ASSERT_EQ(EINVAL, bthread_id_error(cid, ECANCELED));
1193 StopAndJoin();
1194 }
1195
1196 void TestAttachment(bool async, bool short_connection) {
1197 ASSERT_EQ(0, StartAccept(_ep));

Callers

nothing calls this directly

Calls 6

call_idMethod · 0.80
ErrorCodeMethod · 0.80
sub_countMethod · 0.80
subMethod · 0.80
AddChannelMethod · 0.45
FailedMethod · 0.45

Tested by

no test coverage detected