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