Unregister subscriber if "joinRoom" reconnect didn't work.

This will cause a new subscriber object to be created/connected if the client
retries the request.
This commit is contained in:
Joachim Bauch 2020-06-30 16:20:30 +02:00
parent 4ef06867dd
commit b22d9076a3
Failed to extract signature

View file

@ -1013,6 +1013,10 @@ retry:
var roomId uint64
handle, roomId, err = p.mcu.getOrCreateSubscriberHandle(ctx, p.publisher, p.streamType)
if err != nil {
// Reconnection didn't work, need to unregister/remove subscriber
// so a new object will be created if the request is retried.
p.mcu.unregisterClient(p)
p.listener.SubscriberClosed(p)
callback(fmt.Errorf("Already connected as subscriber for %s, error during re-joining: %s", p.streamType, err), nil)
return
}