File tree Expand file tree Collapse file tree 3 files changed +9
-10
lines changed
Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -60,15 +60,15 @@ type hub struct {
6060 systray * systray.Systray
6161}
6262
63- func newHub (serialList * serialPortList , tools * tools.Tools , systray * systray.Systray ) * hub {
63+ func newHub (tools * tools.Tools , systray * systray.Systray ) * hub {
6464 hub := & hub {
6565 broadcast : make (chan []byte , 1000 ),
6666 broadcastSys : make (chan []byte , 1000 ),
6767 register : make (chan * connection ),
6868 unregister : make (chan * connection ),
6969 connections : make (map [* connection ]bool ),
7070 serialHub : newSerialHub (),
71- serialPortList : serialList ,
71+ serialPortList : newSerialPortList ( tools ) ,
7272 tools : tools ,
7373 systray : systray ,
7474 }
@@ -132,6 +132,8 @@ func (hub *hub) sendToRegisteredConnections(data []byte) {
132132}
133133
134134func (hub * hub ) run () {
135+ go hub .serialPortList .Run ()
136+
135137 for {
136138 select {
137139 case c := <- hub .register :
Original file line number Diff line number Diff line change @@ -176,9 +176,7 @@ func loop(stray *systray.Systray) {
176176 }
177177 tools := tools .New (config .GetDataDir (), index , signaturePubKey )
178178
179- serialPorts := newSerialPortList (tools )
180-
181- hub := newHub (serialPorts , tools , stray )
179+ hub := newHub (tools , stray )
182180
183181 // Let's handle the config
184182 configDir := config .GetDefaultConfigDir ()
@@ -394,8 +392,6 @@ func loop(stray *systray.Systray) {
394392 }
395393 }
396394
397- // launch the discoveries for the running system
398- go serialPorts .Run ()
399395 // launch the hub routine which is the singleton for the websocket server
400396 go hub .run ()
401397 // launch our dummy data routine
Original file line number Diff line number Diff line change @@ -241,9 +241,10 @@ func (p *serport) writerNoBuf() {
241241
242242 p .portIo .Close ()
243243
244- // NOTE: by removing the 'serialPorts.List()' line, the list of serial ports are NOT sent to the websocket clients.
245- // after a write is completed. It should not be an issue also because the other two 'writerBuffered' and 'writerRaw' methods
246- // do not call it.
244+ // NOTE: by removing the 'serialPorts.List()' line,
245+ // the list of serial ports are NOT sent to the websocket clients after a write is completed.
246+ // This should not be an issue since the list are periodically called.
247+ // Note also that the 'writerBuffered' and 'writerRaw' methods do not call it.
247248 // serialPorts.List()
248249
249250}
You can’t perform that action at this time.
0 commit comments