Allow WebRTCManager to handle multiple channels for one partner
fredo opened this issue · 1 comments
Without the strict creation mechanism for web rtc it should be possible to handle signalling and channels for more than one channel with the same partner at a time. duplicates can be handled later on. As long as both partners listen on both channels it is no problem to have multiple channels with one partner.
Each channel as well as each signalling message (via matrix) is identified by a unique channel label which is address1|address2|timestamp
. The caller will always create the label while the callee has to accept the label.
As agreed with @fredo, we will actually only ever keep one channel active at any time, regardless of the state the channel is in. In particular, if we get an offer from peer A and we already have an opened channel with A or an unrelated (to the incoming offer) signaling process is in progress with A, we will close the existing channel and respond to the offer, assuming the offer's timestamp is the most recent one.
This helps with the situations where we have a channel between A and B and then A drops the connection, but B is not aware of it yet. Then A comes back online and sends a new offer, which means B will now have to track two connections. In this way, by quickly restarting A, B could keep track of a number of channels needlessly and thereby waste resources.