Fix port ordering

This commit is contained in:
Marcos Lilljedahl
2017-04-16 20:22:37 -03:00
parent d6c359645c
commit 6acb6f47c5
5 changed files with 22 additions and 13 deletions

View File

@@ -8,6 +8,7 @@ import (
"net"
"net/http"
"os"
"sort"
"strings"
"sync"
"time"
@@ -131,8 +132,10 @@ func (s *Session) SchedulePeriodicTasks() {
wg.Wait()
// broadcast all information
for _, ins := range s.Instances {
ins.Ports = ins.tempPorts
ins.Ports = UInt16Slice(ins.tempPorts)
sort.Sort(ins.Ports)
ins.tempPorts = []uint16{}
wsServer.BroadcastTo(ins.session.Id, "instance stats", ins.Name, ins.Mem, ins.Cpu, ins.IsManager, ins.Ports)
}
}