mirror of
https://github.com/ratspeak/microReticulum
synced 2026-11-22 23:10:38 +00:00
Add needs_transport_headers() for TCP hub messaging fix
TCP interfaces behind a hub need HEADER_2 transport wrapping even at hops==1, since the hub can't forward raw HEADER_1 packets. Added virtual needs_transport_headers() to InterfaceImpl (defaults to false) so TCP subclasses can override it without setting is_connected_to_shared_instance (which would brick the device by skipping all Reticulum::loop processing).
This commit is contained in:
1 parent
3bc64abbde
commit
79271a018b
2 files changed
+5
-1
No files matched your search
@@ -82,6 +82,9 @@ namespace RNS {
|
||||
std::list<AnnounceEntry> _announce_queue;
|
||||
bool _is_connected_to_shared_instance = false;
|
||||
bool _is_local_shared_instance = false;
|
||||
|
||||
public:
|
||||
virtual bool needs_transport_headers() const { return _is_connected_to_shared_instance; }
|
||||
//Bytes _hash;
|
||||
HInterface _parent_interface;
|
||||
//Transport& _owner;
|
||||
@@ -155,6 +158,7 @@ namespace RNS {
|
||||
inline void stop() { assert(_impl); return _impl->stop(); }
|
||||
inline void loop() { assert(_impl); return _impl->loop(); }
|
||||
inline const Bytes get_hash() const { assert(_impl); return _impl->get_hash(); }
|
||||
inline bool needs_transport_headers() const { assert(_impl); return _impl->needs_transport_headers(); }
|
||||
void process_announce_queue();
|
||||
|
||||
// CBA ACCUMULATES
|
||||
|
||||
+1
-1
@@ -823,7 +823,7 @@ Transport::DestinationEntry empty_destination_entry;
|
||||
// are "behind" a shared instance, we need to get that instance
|
||||
// to transport it onto the network.
|
||||
//elif Transport.destination_table[packet.destination_hash][2] == 1 and Transport.owner.is_connected_to_shared_instance:
|
||||
else if (destination_entry._hops == 1 && _owner.is_connected_to_shared_instance()) {
|
||||
else if (destination_entry._hops == 1 && (_owner.is_connected_to_shared_instance() || outbound_interface.needs_transport_headers())) {
|
||||
TRACE("Transport::outbound: Sending packet for directly connected interface to shared instance...");
|
||||
if (packet.header_type() == Type::Packet::HEADER_1) {
|
||||
// Insert packet into transport
|
||||
|
||||
Reference in new issue
Block a user