From 87fb6ac2d32fb54532c9819f410d764c111aebb6 Mon Sep 17 00:00:00 2001 From: zarazaex69 Date: Tue, 14 Apr 2026 00:25:39 +0300 Subject: [PATCH] fix(peer): move onReconnect callback to after session restart --- internal/telemost/peer.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/telemost/peer.go b/internal/telemost/peer.go index 3d68cde..cf9efe0 100644 --- a/internal/telemost/peer.go +++ b/internal/telemost/peer.go @@ -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 {