diff --git a/rtpconn/rtpconn.go b/rtpconn/rtpconn.go index d9b2684..a9f2a79 100644 --- a/rtpconn/rtpconn.go +++ b/rtpconn/rtpconn.go @@ -508,8 +508,6 @@ type rtpUpConnection struct { id string client group.Client label string - userId string - username string pc *webrtc.PeerConnection iceCandidates []*webrtc.ICECandidateInit @@ -548,7 +546,7 @@ func (up *rtpUpConnection) Label() string { } func (up *rtpUpConnection) User() (string, string) { - return up.userId, up.username + return up.client.Id(), up.client.Username() } func (up *rtpUpConnection) AddLocal(local conn.Down) error { diff --git a/rtpconn/webclient.go b/rtpconn/webclient.go index 1d05b86..7a6bc59 100644 --- a/rtpconn/webclient.go +++ b/rtpconn/webclient.go @@ -211,9 +211,12 @@ func delUpConn(c *webClient, id string, userId string, push bool) error { c.mu.Unlock() return os.ErrNotExist } - if userId != "" && conn.userId != userId { - c.mu.Unlock() - return ErrUserMismatch + if userId != "" { + id, _ := conn.User() + if id != userId { + c.mu.Unlock() + return ErrUserMismatch + } } replace := conn.getReplace(false) @@ -576,8 +579,6 @@ func gotOffer(c *webClient, id, label string, sdp string, replace string) error return err } - up.userId = c.Id() - up.username = c.Username() if replace != "" { up.replace = replace delUpConn(c, replace, c.Id(), false)