mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-05-03 06:13:17 +02:00
Merge pull request #327 from strukturag/fix-proxy-deadlock
Fix deadlock for proxy connection issues
This commit is contained in:
commit
1774d56d7d
|
@ -839,6 +839,7 @@ func (s *ClientSession) GetOrCreatePublisher(ctx context.Context, mcu Mcu, strea
|
|||
if !found {
|
||||
client := s.getClientUnlocked()
|
||||
s.mu.Unlock()
|
||||
defer s.mu.Lock()
|
||||
|
||||
bitrate := data.Bitrate
|
||||
if backend := s.Backend(); backend != nil {
|
||||
|
@ -856,7 +857,6 @@ func (s *ClientSession) GetOrCreatePublisher(ctx context.Context, mcu Mcu, strea
|
|||
}
|
||||
var err error
|
||||
publisher, err = mcu.NewPublisher(ctx, s, s.PublicId(), data.Sid, streamType, bitrate, mediaTypes, client)
|
||||
s.mu.Lock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -488,7 +488,7 @@ func (c *mcuProxyConnection) sendPing() bool {
|
|||
c.conn.SetWriteDeadline(now.Add(writeWait)) // nolint
|
||||
if err := c.conn.WriteMessage(websocket.PingMessage, []byte(msg)); err != nil {
|
||||
log.Printf("Could not send ping to proxy at %s: %v", c, err)
|
||||
c.scheduleReconnect()
|
||||
go c.scheduleReconnect()
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -1042,6 +1042,8 @@ func (c *mcuProxyConnection) newPublisher(ctx context.Context, listener McuListe
|
|||
if err != nil {
|
||||
// TODO: Cancel request
|
||||
return nil, err
|
||||
} else if response.Type == "error" {
|
||||
return nil, fmt.Errorf("Error creating %s publisher for %s on %s: %+v", streamType, id, c, response.Error)
|
||||
}
|
||||
|
||||
proxyId := response.Command.Id
|
||||
|
@ -1070,6 +1072,8 @@ func (c *mcuProxyConnection) newSubscriber(ctx context.Context, listener McuList
|
|||
if err != nil {
|
||||
// TODO: Cancel request
|
||||
return nil, err
|
||||
} else if response.Type == "error" {
|
||||
return nil, fmt.Errorf("Error creating %s subscriber for %s on %s: %+v", streamType, publisherSessionId, c, response.Error)
|
||||
}
|
||||
|
||||
proxyId := response.Command.Id
|
||||
|
|
Loading…
Reference in a new issue