-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Support for TCP is actually half-way (or even a bit more?) there in that we already:
- Support TCP addressing
- Disable the
"Reliability"MRP code path for packets which have the R flag (used for BTP already) - Support large packets - need to double-check if these packet sizes conform to the Matter Core Spec
- Support initialization of large packet buffers in the transport, with feature
large-buffers rs-mattercore is agnostic to the concrete transport, and moreover - transports can be chained, where chaining is already used during concurrent commissioning for chaining BTP and UDP
What needs to be done:
Add a tcp.rs implementation on top of async-io similar to the udp.rs one:
- Support TCP
acceptand add the accepted TCP stream to a pool of streams, where each stream is keyed by its TCP address. Think what to do when we get two tcp streams with the same peer TCP address? Perhaps we should just close the earlier one, without sending any exchangeCloseMatter message, as likely, the other peer considers the older stream "stale" if it is opening a new one? - Support TCP
connectand add the connected TCP stream to the pool of streams; necessary when a subscription needs to send data to a peer which does not have an opened TCP stream ATM; or in general for any outgoing message - if the peer to which the message is addressed does not have an opened TCP stream in the streams' pool, such one needs to be opened (withconnect) on-the-fly; - Support eviction of closed/timing-out/stale TCP streams from the pool of streams. TCP stream closure can be detected when reading from the TCP stream (so that we get the
FINfrom the other peer). The TCP impl would therefore likely need to constantly poll the streams in the stream pool forreadableand close those where it gets aFIN. This would naturally happen in itsNetworkReceive::wait_availableandNetworkReceive::recv_fromimpls, but we also need user-configurable timeouts forNetworkReceive::recv_fromandNetworkReceive::send_to - We might need to also time-out streams where we have not received anything for a very long time (long timeout). Need to check if/how the C++ SDK does this. Also good to check the TCP impl of the C++ SDK anyway
- Think whether a TCP stream need to be eagerly closed when an exchange on that stream is over. Check how the C++ SDK does it. It is likely not doing an eager close and is re-using the streams across exchanges and for multiple exchanges with the same peer, as the Matter Core Spec seems to hint at using TCP keep alive ACKs for "long living" TCP streams
- Advertise TCP support via mDNS
I would say, a relatively easy and straight-forward task.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request