mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-06-05 20:09:47 +00:00
fix(peer): move onReconnect callback to after session restart
This commit is contained in:
@@ -938,10 +938,6 @@ func (p *Peer) reconnect(ctx context.Context) error {
|
||||
p.reconnecting.Store(true)
|
||||
defer p.reconnecting.Store(false)
|
||||
|
||||
if p.onReconnect != nil {
|
||||
p.onReconnect(nil)
|
||||
}
|
||||
|
||||
p.sendLeave(uuid.New().String())
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
p.stopSession()
|
||||
@@ -964,6 +960,10 @@ func (p *Peer) reconnect(ctx context.Context) error {
|
||||
p.wsMu.Unlock()
|
||||
}
|
||||
|
||||
if p.onReconnect != nil {
|
||||
p.onReconnect(nil)
|
||||
}
|
||||
|
||||
time.Sleep(3 * time.Second)
|
||||
conn, err := GetConnectionInfo(ctx, p.roomURL, p.name)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user