Fixed JSON call

pull/526/head
Jim Jacobsen 2016-11-17 07:25:36 +00:00
rodzic 3a5a5e5048
commit 2b3d06eafa
1 zmienionych plików z 11 dodań i 10 usunięć

Wyświetl plik

@ -143,7 +143,7 @@ func sendToAllConnectedClients(msg networkMessage) {
if (msg.msgType & NETWORK_GDL90_STANDARD) != 0 { if (msg.msgType & NETWORK_GDL90_STANDARD) != 0 {
// It's a GDL90 message. Send to serial output channel (which may or may not cause something to happen). // It's a GDL90 message. Send to serial output channel (which may or may not cause something to happen).
serialOutputChan <- msg.msg serialOutputChan <- msg.msg
networkGDL90Chan <- msg.msg networkGDL90Chan <- msg.msg
} }
netMutex.Lock() netMutex.Lock()
@ -196,14 +196,15 @@ var serialOutputChan chan []byte
var networkGDL90Chan chan []byte var networkGDL90Chan chan []byte
func networkOutWatcher() { func networkOutWatcher() {
//ticker := time.NewTicker(10 * time.Second) //ticker := time.NewTicker(10 * time.Second)
//var nmsg gdl90NetMessage //var nmsg gdl90NetMessage
for { for {
select { select {
case ch := <-networkGDL90Chan: case ch := <-networkGDL90Chan:
gdl90Update.SendJSON(ch) gdlJSON, _ := json.Marshal(ch)
} gdl90Update.Send(gdlJSON)
} }
}
} }
// Monitor serial output channel, send to serial port. // Monitor serial output channel, send to serial port.
@ -616,7 +617,7 @@ func ffMonitor() {
func initNetwork() { func initNetwork() {
messageQueue = make(chan networkMessage, 1024) // Buffered channel, 1024 messages. messageQueue = make(chan networkMessage, 1024) // Buffered channel, 1024 messages.
serialOutputChan = make(chan []byte, 1024) // Buffered channel, 1024 GDL90 messages. serialOutputChan = make(chan []byte, 1024) // Buffered channel, 1024 GDL90 messages.
networkGDL90Chan = make(chan []byte, 1024) networkGDL90Chan = make(chan []byte, 1024)
outSockets = make(map[string]networkConnection) outSockets = make(map[string]networkConnection)
pingResponse = make(map[string]time.Time) pingResponse = make(map[string]time.Time)
netMutex = &sync.Mutex{} netMutex = &sync.Mutex{}