While discussing with @kress95 we had some thoughts about its implementation:
How should we check if a bounce is being used?
There are three options for that:
Reference counting, anytime something uses a bounce it would do a dispatch that increments the reference count (and the reverse is also true):
This method is simple in theory but complex in practice, forgetting to dispatch would lead to incorrect behaviour.
Dispatches should happen after events, so tabs can keep correct reference counts.
I'm not a fan of this method, it's simple but error prone.
This method is the fastest to run.
Checking tunnels. but they aren't properly implemented yet:
This method is complex and slow but fast enough for single check.
The code is complex depending on Tunnels implementation, if tunnels are owned by servers, the function would have to fold every server.
A request would tell us if a bounce is being used or not:
This method is the slower to run but faster to code.
Using this method is a PITA, it requires two messages to perform one thing: one to ask to edit a Bounce, another to check the request response.
Should we break all active channels that use this bounce?
We're assuming that editing a bounce kills every active connection using it, but does it apply to channels? A channel using that bounce should also be killed?
I'm leaning toward the 2nd method, but my opinion might change depending on the outcome of the later problem (or even other not discussed yet problem).
While discussing with @kress95 we had some thoughts about its implementation:
How should we check if a bounce is being used?
There are three options for that:
Should we break all active channels that use this bounce?
We're assuming that editing a bounce kills every active connection using it, but does it apply to channels? A channel using that bounce should also be killed?
@pedrohlc @renatomassaro