File tree 3 files changed +9
-10
lines changed
3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -60,15 +60,15 @@ type hub struct {
60
60
systray * systray.Systray
61
61
}
62
62
63
- func newHub (serialList * serialPortList , tools * tools.Tools , systray * systray.Systray ) * hub {
63
+ func newHub (tools * tools.Tools , systray * systray.Systray ) * hub {
64
64
hub := & hub {
65
65
broadcast : make (chan []byte , 1000 ),
66
66
broadcastSys : make (chan []byte , 1000 ),
67
67
register : make (chan * connection ),
68
68
unregister : make (chan * connection ),
69
69
connections : make (map [* connection ]bool ),
70
70
serialHub : newSerialHub (),
71
- serialPortList : serialList ,
71
+ serialPortList : newSerialPortList ( tools ) ,
72
72
tools : tools ,
73
73
systray : systray ,
74
74
}
@@ -132,6 +132,8 @@ func (hub *hub) sendToRegisteredConnections(data []byte) {
132
132
}
133
133
134
134
func (hub * hub ) run () {
135
+ go hub .serialPortList .Run ()
136
+
135
137
for {
136
138
select {
137
139
case c := <- hub .register :
Original file line number Diff line number Diff line change @@ -176,9 +176,7 @@ func loop(stray *systray.Systray) {
176
176
}
177
177
tools := tools .New (config .GetDataDir (), index , signaturePubKey )
178
178
179
- serialPorts := newSerialPortList (tools )
180
-
181
- hub := newHub (serialPorts , tools , stray )
179
+ hub := newHub (tools , stray )
182
180
183
181
// Let's handle the config
184
182
configDir := config .GetDefaultConfigDir ()
@@ -394,8 +392,6 @@ func loop(stray *systray.Systray) {
394
392
}
395
393
}
396
394
397
- // launch the discoveries for the running system
398
- go serialPorts .Run ()
399
395
// launch the hub routine which is the singleton for the websocket server
400
396
go hub .run ()
401
397
// launch our dummy data routine
Original file line number Diff line number Diff line change @@ -241,9 +241,10 @@ func (p *serport) writerNoBuf() {
241
241
242
242
p .portIo .Close ()
243
243
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.
247
248
// serialPorts.List()
248
249
249
250
}
You can’t perform that action at this time.
0 commit comments