mutext for voice and mobile conn
parent
7326a1c98b
commit
65c162099b
|
@ -15,15 +15,15 @@ type WebClientDb struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebClient struct {
|
type WebClient struct {
|
||||||
Uuid string
|
Uuid string
|
||||||
MobileConn *websocket.Conn
|
MobileConn *websocket.Conn
|
||||||
mobileConnMu sync.Mutex
|
mobileConnMu sync.Mutex
|
||||||
VoiceConn *websocket.Conn
|
VoiceConn *websocket.Conn
|
||||||
voiceConnMu sync.Mutex
|
voiceConnMu sync.Mutex
|
||||||
MobileCmdIDs []int
|
MobileCmdIDs []int
|
||||||
mobileCmdMu sync.Mutex
|
mobileCmdIDMu sync.Mutex
|
||||||
VoiceCmdIDs []int
|
VoiceCmdIDs []int
|
||||||
voiceCmdMu sync.Mutex
|
voiceCmdIDMu sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (webClient *WebClient) SendBinaryMessage(conn *websocket.Conn, msg []byte) error {
|
func (webClient *WebClient) SendBinaryMessage(conn *websocket.Conn, msg []byte) error {
|
||||||
|
@ -38,8 +38,8 @@ func (webClient *WebClient) SendBinaryMessage(conn *websocket.Conn, msg []byte)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (webClient *WebClient) RemoveVoiceCmdID(cmdID int) {
|
func (webClient *WebClient) RemoveVoiceCmdID(cmdID int) {
|
||||||
webClient.voiceCmdMu.Lock()
|
webClient.voiceCmdIDMu.Lock()
|
||||||
defer webClient.voiceCmdMu.Unlock()
|
defer webClient.voiceCmdIDMu.Unlock()
|
||||||
|
|
||||||
newArr, err := removeCmdIDFromList(webClient.VoiceCmdIDs, cmdID)
|
newArr, err := removeCmdIDFromList(webClient.VoiceCmdIDs, cmdID)
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ func (webClient *WebClient) RemoveVoiceCmdID(cmdID int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (webClient *WebClient) RemoveMobileCmdID(cmdID int) {
|
func (webClient *WebClient) RemoveMobileCmdID(cmdID int) {
|
||||||
webClient.mobileCmdMu.Lock()
|
webClient.mobileCmdIDMu.Lock()
|
||||||
defer webClient.mobileCmdMu.Unlock()
|
defer webClient.mobileCmdIDMu.Unlock()
|
||||||
|
|
||||||
newArr, err := removeCmdIDFromList(webClient.MobileCmdIDs, cmdID)
|
newArr, err := removeCmdIDFromList(webClient.MobileCmdIDs, cmdID)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue