fix(peer): move onReconnect callback to after session restart

This commit is contained in:
zarazaex69
2026-04-14 00:25:39 +03:00
parent 1509f28e23
commit 87fb6ac2d3

View File

@@ -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 {