MCPcopy Create free account
hub / github.com/bcndev/bytecoin / levin_method

Function levin_method

src/p2p/P2PProtocolBasic.cpp:12–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11template<typename Cmd>
12P2PProtocolBasic::LevinHandlerFunction levin_method(void (P2PProtocolBasic::*handler)(Cmd &&)) {
13 return [handler](P2PProtocolBasic *who, BinaryArray &&body) {
14 Cmd req{};
15 if (!LevinProtocol::decode(body, req)) {
16 who->disconnect("Request failed to parse");
17 return;
18 }
19
20 (who->*handler)(std::move(req));
21 };
22}
23
24template<typename Cmd>
25std::pair<std::pair<uint32_t, LevinProtocol::CommandType>, std::pair<P2PProtocolBasic::LevinHandlerFunction, size_t>>

Callers 1

levin_pairFunction · 0.85

Calls 2

decodeFunction · 0.50
disconnectMethod · 0.45

Tested by

no test coverage detected