Skip traffic targets on websocket with no valid position.

pull/73/head
Christopher Young 2015-09-30 18:52:52 -04:00
rodzic aafcd4892c
commit 2661c86560
2 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -43,6 +43,9 @@ func handleWeatherWS(conn *websocket.Conn) {
func handleTrafficWS(conn *websocket.Conn) {
trafficMutex.Lock()
for _, traf := range traffic {
if !traf.Position_valid { // Don't send unless a valid position exists.
continue
}
trafficJSON, _ := json.Marshal(&traf)
conn.Write(trafficJSON)
}

Wyświetl plik

@ -96,7 +96,9 @@ func sendTrafficUpdates() {
// Send update to attached client.
func registerTrafficUpdate(ti TrafficInfo) {
trafficUpdate <- ti
if ti.Position_valid { // Don't send unless a valid position exists.
trafficUpdate <- ti
}
}
func makeTrafficReport(ti TrafficInfo) {