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

Function FindProtocol

src/brpc/protocol.cpp:100–111  ·  view source on GitHub ↗

Called frequently, must be fast.

Source from the content-addressed store, hash-verified

98
99// Called frequently, must be fast.
100const Protocol* FindProtocol(ProtocolType type) {
101 const size_t index = type;
102 if (index >= MAX_PROTOCOL_SIZE) {
103 LOG(ERROR) << "ProtocolType=" << type << " is out of range";
104 return NULL;
105 }
106 ProtocolEntry* const protocol_map = get_protocol_map();
107 if (protocol_map[index].valid.load(butil::memory_order_acquire)) {
108 return &protocol_map[index].protocol;
109 }
110 return NULL;
111}
112
113void ListProtocols(std::vector<Protocol>* vec) {
114 vec->clear();

Callers 7

FindProtocolIndexMethod · 0.85
ProtocolTypeToStringFunction · 0.85
InitChannelOptionsMethod · 0.85
InitMethod · 0.85
InitALPNOptionsMethod · 0.85
PrintClientSpanFunction · 0.85
PrintServerSpanFunction · 0.85

Calls 2

get_protocol_mapFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected