mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
webrtc implement signal close.
This commit is contained in:
parent
d20fa071e7
commit
55a2b14aea
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
|
|
||||||
"demodesk/neko/internal/types"
|
"demodesk/neko/internal/types"
|
||||||
|
"demodesk/neko/internal/types/event"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SessionCtx struct {
|
type SessionCtx struct {
|
||||||
@ -143,10 +144,15 @@ func (session *SessionCtx) SetWebRTCConnected(webrtcPeer types.WebRTCPeer, conne
|
|||||||
}
|
}
|
||||||
|
|
||||||
session.webrtcMu.Lock()
|
session.webrtcMu.Lock()
|
||||||
if webrtcPeer == session.webrtcPeer {
|
isCurrentPeer = webrtcPeer == session.webrtcPeer
|
||||||
|
if isCurrentPeer {
|
||||||
session.webrtcPeer = nil
|
session.webrtcPeer = nil
|
||||||
}
|
}
|
||||||
session.webrtcMu.Unlock()
|
session.webrtcMu.Unlock()
|
||||||
|
|
||||||
|
if isCurrentPeer {
|
||||||
|
session.Send(event.SIGNAL_CLOSE, nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (session *SessionCtx) GetWebRTCPeer() types.WebRTCPeer {
|
func (session *SessionCtx) GetWebRTCPeer() types.WebRTCPeer {
|
||||||
|
@ -15,6 +15,7 @@ const (
|
|||||||
SIGNAL_PROVIDE = "signal/provide"
|
SIGNAL_PROVIDE = "signal/provide"
|
||||||
SIGNAL_CANDIDATE = "signal/candidate"
|
SIGNAL_CANDIDATE = "signal/candidate"
|
||||||
SIGNAL_VIDEO = "signal/video"
|
SIGNAL_VIDEO = "signal/video"
|
||||||
|
SIGNAL_CLOSE = "signal/close"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Loading…
Reference in New Issue
Block a user