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

Function GetOrCreateSession

test/brpc_redis_cluster_unittest.cpp:161–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159};
160
161static Session* GetOrCreateSession(brpc::RedisConnContext* ctx) {
162 if (ctx == NULL) {
163 return NULL;
164 }
165 Session* s = static_cast<Session*>(ctx->get_session());
166 if (s == NULL) {
167 s = new Session;
168 ctx->reset_session(s);
169 }
170 return s;
171}
172
173static bool ParseEndpoint(const std::string& endpoint, std::string* host, int* port) {
174 size_t pos = endpoint.rfind(':');

Callers 2

RunMethod · 0.85
RunMethod · 0.85

Calls 2

get_sessionMethod · 0.80
reset_sessionMethod · 0.80

Tested by

no test coverage detected