MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / parse_inbound

Method parse_inbound

nodedb-cluster/src/transport/client/send.rs:194–202  ·  view source on GitHub ↗

Parse an inbound envelope: verify MAC, check replay window, decode inner RPC. Self-addressed frames skip the replay-window check. In a single-node test (or when a node genuinely dispatches an RPC to itself over the transport) the client and server share one `AuthContext`, which means one `peer_seq_in` window is updated by *both* the server-side request-accept and the client-side response-accept.

(&self, envelope: &[u8])

Source from the content-addressed store, hash-verified

192 /// was never replayed, the same window simply saw traffic from both
193 /// directions for `peer_id == local_node_id`.
194 fn parse_inbound(&self, envelope: &[u8]) -> Result<RaftRpc> {
195 let (fields, inner_frame) = auth_envelope::parse_envelope(envelope, &self.auth.mac_key)?;
196 if fields.from_node_id != self.auth.local_node_id {
197 self.auth
198 .peer_seq_in
199 .accept(fields.from_node_id, fields.seq)?;
200 }
201 rpc_codec::decode(inner_frame)
202 }
203}

Callers 2

try_send_onceMethod · 0.80

Calls 3

acceptMethod · 0.80
parse_envelopeFunction · 0.50
decodeFunction · 0.50

Tested by

no test coverage detected