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

Function SendSleepRPC

test/brpc_server_unittest.cpp:1250–1269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1248}
1249
1250void SendSleepRPC(butil::EndPoint ep, int sleep_ms, bool succ) {
1251 brpc::Channel channel;
1252 ASSERT_EQ(0, channel.Init(ep, NULL));
1253
1254 brpc::Controller cntl;
1255 test::EchoRequest req;
1256 test::EchoResponse res;
1257 req.set_message(EXP_REQUEST);
1258 if (sleep_ms > 0) {
1259 req.set_sleep_us(sleep_ms * 1000);
1260 }
1261 test::EchoService_Stub stub(&channel);
1262 stub.Echo(&cntl, &req, &res, NULL);
1263 if (succ) {
1264 EXPECT_FALSE(cntl.Failed()) << cntl.ErrorText()
1265 << " latency=" << cntl.latency_us();
1266 } else {
1267 EXPECT_TRUE(cntl.Failed());
1268 }
1269}
1270
1271TEST_F(ServerTest, close_idle_connections) {
1272 butil::EndPoint ep;

Callers

nothing calls this directly

Calls 5

ErrorTextMethod · 0.80
latency_usMethod · 0.80
InitMethod · 0.45
EchoMethod · 0.45
FailedMethod · 0.45

Tested by

no test coverage detected