mirror of https://github.com/jetkvm/kvm.git
Compare commits
3 Commits
8f86d6ed26
...
80e2881fe8
Author | SHA1 | Date |
---|---|---|
|
80e2881fe8 | |
|
a916a1629f | |
|
8e27cd6b60 |
|
@ -284,10 +284,6 @@ function KeyboardWrapper() {
|
|||
preventMouseUpDefault={true}
|
||||
stopMouseDownPropagation={true}
|
||||
stopMouseUpPropagation={true}
|
||||
physicalKeyboardHighlight={true}
|
||||
physicalKeyboardHighlightPreventDefault={true}
|
||||
physicalKeyboardHighlightTextColor="black"
|
||||
physicalKeyboardHighlightBgColor="lightblue"
|
||||
/>
|
||||
|
||||
<div className="controlArrows">
|
||||
|
@ -305,10 +301,6 @@ function KeyboardWrapper() {
|
|||
preventMouseUpDefault={true}
|
||||
stopMouseDownPropagation={true}
|
||||
stopMouseUpPropagation={true}
|
||||
physicalKeyboardHighlight={true}
|
||||
physicalKeyboardHighlightPreventDefault={true}
|
||||
physicalKeyboardHighlightTextColor="black"
|
||||
physicalKeyboardHighlightBgColor="lightblue"
|
||||
/>
|
||||
<Keyboard
|
||||
baseClass="simple-keyboard-arrows"
|
||||
|
@ -323,10 +315,6 @@ function KeyboardWrapper() {
|
|||
preventMouseUpDefault={true}
|
||||
stopMouseDownPropagation={true}
|
||||
stopMouseUpPropagation={true}
|
||||
physicalKeyboardHighlight={true}
|
||||
physicalKeyboardHighlightPreventDefault={true}
|
||||
physicalKeyboardHighlightTextColor="black"
|
||||
physicalKeyboardHighlightBgColor="lightblue"
|
||||
/>
|
||||
</div>
|
||||
{ /* TODO add optional number pad */ }
|
||||
|
|
15
webrtc.go
15
webrtc.go
|
@ -23,6 +23,7 @@ type Session struct {
|
|||
HidChannel *webrtc.DataChannel
|
||||
DiskChannel *webrtc.DataChannel
|
||||
shouldUmountVirtualMedia bool
|
||||
rpcQueue chan webrtc.DataChannelMessage
|
||||
}
|
||||
|
||||
type SessionConfig struct {
|
||||
|
@ -106,6 +107,12 @@ func newSession(config SessionConfig) (*Session, error) {
|
|||
return nil, err
|
||||
}
|
||||
session := &Session{peerConnection: peerConnection}
|
||||
session.rpcQueue = make(chan webrtc.DataChannelMessage, 256)
|
||||
go func() {
|
||||
for msg := range session.rpcQueue {
|
||||
onRPCMessage(msg, session)
|
||||
}
|
||||
}()
|
||||
|
||||
peerConnection.OnDataChannel(func(d *webrtc.DataChannel) {
|
||||
scopedLogger.Info().Str("label", d.Label()).Uint16("id", *d.ID()).Msg("New DataChannel")
|
||||
|
@ -113,7 +120,8 @@ func newSession(config SessionConfig) (*Session, error) {
|
|||
case "rpc":
|
||||
session.RPCChannel = d
|
||||
d.OnMessage(func(msg webrtc.DataChannelMessage) {
|
||||
go onRPCMessage(msg, session)
|
||||
// Enqueue to ensure ordered processing
|
||||
session.rpcQueue <- msg
|
||||
})
|
||||
triggerOTAStateUpdate()
|
||||
triggerVideoStateUpdate()
|
||||
|
@ -189,6 +197,11 @@ func newSession(config SessionConfig) (*Session, error) {
|
|||
if session == currentSession {
|
||||
currentSession = nil
|
||||
}
|
||||
// Stop RPC processor
|
||||
if session.rpcQueue != nil {
|
||||
close(session.rpcQueue)
|
||||
session.rpcQueue = nil
|
||||
}
|
||||
if session.shouldUmountVirtualMedia {
|
||||
if err := rpcUnmountImage(); err != nil {
|
||||
scopedLogger.Warn().Err(err).Msg("unmount image failed on connection close")
|
||||
|
|
Loading…
Reference in New Issue