Skip to content

Commit

Permalink
Removes NullErrorHandler. Instead, prevents generating an OIR for any
Browse files Browse the repository at this point in the history
incoming unhandled error message (OIR and TDE).
  • Loading branch information
balazsracz committed Sep 7, 2024
1 parent cc64e1b commit 883cd86
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 29 deletions.
1 change: 0 additions & 1 deletion src/openlcb/IfCan.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,6 @@ IfCan::IfCan(ExecutorBase *executor, CanHubFlow *device,
add_owned_flow(new FrameToGlobalMessageParser(this));
add_owned_flow(new VerifyNodeIdHandler(this));
add_owned_flow(new UnhandledAddressedMessageHandler(this));
add_owned_flow(new NullErrorHandler(this));
add_owned_flow(new RemoteAliasCacheUpdater(this));
add_owned_flow(new AMEQueryHandler(this));
add_owned_flow(new AMEGlobalQueryHandler(this));
Expand Down
35 changes: 8 additions & 27 deletions src/openlcb/IfImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@ public:
// Destination is not a local node.
return release_and_exit();
}
auto mti = message()->data()->mti;
if (mti == Defs::MTI_OPTIONAL_INTERACTION_REJECTED ||
mti == Defs::MTI_TERMINATE_DUE_TO_ERROR) {
// We don't generate an OIR for an incoming error report, as this
// generally would cause an infinite bouncing of error reports back
// and forth between two OpenMRN nodes.
return release_and_exit();
}
return allocate_and_call(
iface()->addressed_message_write_flow(), STATE(fill_oir));
}
Expand All @@ -311,33 +319,6 @@ public:
}
};

/// This is an addressed message handler that catches errors (OIR and TDE) but
/// ignores them. While this sounds not super useful, it ensures that these
/// messages never trigger the UnhandledAddressedMessageHandler.
class NullErrorHandler : public IncomingMessageStateFlow
{
public:
NullErrorHandler(If *service)
: IncomingMessageStateFlow(service)
{
service->dispatcher()->register_handler(
this, Defs::MTI_OPTIONAL_INTERACTION_REJECTED, Defs::MTI_EXACT);
service->dispatcher()->register_handler(
this, Defs::MTI_TERMINATE_DUE_TO_ERROR, Defs::MTI_EXACT);
}

void send(Buffer<GenMessage> *b, unsigned) override
{
b->unref();
}

Action entry() override
{
DIE("should not get here");
return release_and_exit();
}
};

} // namespace openlcb

#endif // _OPENLCB_IFIMPL_HXX_
1 change: 0 additions & 1 deletion src/openlcb/IfTcp.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ IfTcp::IfTcp(NodeID gateway_node_id, HubFlow *device, int local_nodes_count)
, device_(device)
{
add_owned_flow(new VerifyNodeIdHandler(this));
add_owned_flow(new NullErrorHandler(this));
add_owned_flow(new UnhandledAddressedMessageHandler(this));
seq_ = new ClockBaseSequenceNumberGenerator;
add_owned_flow(seq_);
Expand Down

0 comments on commit 883cd86

Please sign in to comment.