mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-10-05 09:53:21 +08:00
Show docker swarm used ports
This commit is contained in:
@@ -94,6 +94,12 @@ func (s *Session) SchedulePeriodicTasks() {
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
// broadcast all information
|
||||
for _, ins := range s.Instances {
|
||||
ins.Ports = ins.tempPorts
|
||||
ins.tempPorts = []uint16{}
|
||||
wsServer.BroadcastTo(ins.session.Id, "instance stats", ins.Name, ins.Mem, ins.Cpu, ins.IsManager, ins.Ports)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
@@ -123,7 +129,9 @@ func CloseSession(s *Session) error {
|
||||
s.rw.Lock()
|
||||
defer s.rw.Unlock()
|
||||
|
||||
s.ticker.Stop()
|
||||
if s.ticker != nil {
|
||||
s.ticker.Stop()
|
||||
}
|
||||
wsServer.BroadcastTo(s.Id, "session end")
|
||||
log.Printf("Starting clean up of session [%s]\n", s.Id)
|
||||
for _, i := range s.Instances {
|
||||
@@ -238,6 +246,13 @@ func LoadSessionsFromDisk() error {
|
||||
|
||||
}
|
||||
|
||||
// Connect PWD daemon to the new network
|
||||
if err := ConnectNetwork("pwd", s.Id); err != nil {
|
||||
log.Println("ERROR NETWORKING")
|
||||
return err
|
||||
}
|
||||
log.Printf("Connected pwd to network [%s]\n", s.Id)
|
||||
|
||||
// Schedule peridic tasks execution
|
||||
s.SchedulePeriodicTasks()
|
||||
}
|
||||
|
Reference in New Issue
Block a user