Open daboross opened 4 years ago
Hmm, yeah, we want something like this eventually, but getting it correct is a bit more involved. For example, the low-priority part of the stack needs to know that the connection is being teared down to drain the packet queue before the operation can complete (otherwise establishing a new connection will start processing and transmitting packets from the old connection, which is pretty bad).
That said, going from "advertising" to "not advertising" should be trivial. Maybe we should have a stop_advertising
function instead that will panic when a connection is established, if that helps with your use case?
That makes a lot of sense! I assumed some teardown would be needed, but didn't realize that this could even result in sending packets to the wrong connection.
I think a stop_advertising
function could be useful, though it would allow accessing the same kind of bad situation if one calls start_advertising
immediately followed by stop_advertising
. I don't have a super compelling use case for this in any case, it would just be adding a feature so that it could be exposed to tock apps.
I think we definitely want some kind of connection termination at some point, though. Would it be alright if I opened up a new issue just to track that?
Sure!
I'm mainly wanting to arbitrarily stop advertising - I'm not at all sure how much this makes sense in practice, but it seems like a useful control to have for completeness? It's a single function
LinkLayer::enter_standby
which returns aCmd
and does as the name suggests.This doesn't gracefully end connections - it's doing the same thing as starting advertising when one has an existing connection, but just not advertising instead.