Skip to content

Commit

Permalink
race
Browse files Browse the repository at this point in the history
  • Loading branch information
boks1971 committed Nov 19, 2023
1 parent dc71bfb commit 7aa190c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions signalclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,16 @@ func (c *SignalClient) Join(urlPrefix string, token string, params *ConnectParam

func (c *SignalClient) Close() {
isStarted := c.IsStarted()
if conn := c.websocketConn(); conn != nil {
conn := c.websocketConn()
if conn != nil {
_ = conn.Close()
}
if isStarted {
<-c.readerClosedCh
}
if conn != nil {
c.OnClose()
}
}

func (c *SignalClient) SendICECandidate(candidate webrtc.ICECandidateInit, target livekit.SignalTarget) error {
Expand Down Expand Up @@ -348,10 +352,6 @@ func (c *SignalClient) readWorker() {
c.isStarted.Store(false)
c.conn.Store((*websocket.Conn)(nil))
close(c.readerClosedCh)

if c.OnClose != nil {
c.OnClose()
}
}()
if pending := c.pendingResponse; pending != nil {
c.handleResponse(pending)
Expand Down

0 comments on commit 7aa190c

Please sign in to comment.