MCPcopy Create free account
hub / github.com/actor-framework/actor-framework / handle

Method handle

libcaf_io/caf/io/basp/instance.cpp:49–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49connection_state instance::handle(scheduler* ctx, new_data_msg& dm, header& hdr,
50 bool is_payload) {
51 auto lg = log::io::trace("dm = {}, is_payload = {}", dm, is_payload);
52 // function object providing cleanup code on errors
53 auto err = [&](connection_state code) {
54 if (auto nid = tbl_.erase_direct(dm.handle))
55 callee_.purge_state(nid);
56 return code;
57 };
58 byte_buffer* payload = nullptr;
59 if (is_payload) {
60 payload = &dm.buf;
61 if (payload->size() != hdr.payload_len) {
62 log::io::warning("received invalid payload, expected {} bytes, got {}",
63 hdr.payload_len, payload->size());
64 return err(malformed_message);
65 }
66 } else {
67 binary_deserializer source{*sys_, dm.buf};
68 if (!source.apply(hdr)) {
69 log::io::warning("failed to receive header: {}", source.get_error());
70 return err(malformed_message);
71 }
72 if (!valid(hdr)) {
73 log::io::warning("received invalid header: hdr = {}", hdr);
74 return err(malformed_message);
75 }
76 if (hdr.payload_len > 0) {
77 log::io::debug("await payload before processing further");
78 return await_payload;
79 }
80 }
81 log::io::debug("hdr = {}", hdr);
82 return handle(ctx, dm.handle, hdr, payload);
83}
84
85void instance::handle_heartbeat(scheduler* ctx) {
86 auto lg = log::io::trace("");

Callers

nothing calls this directly

Calls 15

traceFunction · 0.85
warningFunction · 0.85
debugFunction · 0.85
handleClass · 0.85
make_message_idFunction · 0.85
erase_directMethod · 0.80
purge_stateMethod · 0.80
finalize_handshakeMethod · 0.80
lookup_directMethod · 0.80
add_directMethod · 0.80
erase_indirectMethod · 0.80

Tested by

no test coverage detected