Skip to content

Commit 3bcbd96

Browse files
committed
Made spCloseRead a method of serialport
1 parent 38f70e9 commit 3bcbd96

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

serialport.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (p *serport) reader(buftype string) {
167167
}
168168
}
169169
if p.isClosingDueToError {
170-
spCloseReal(p)
170+
p.Close()
171171
}
172172
}
173173

@@ -348,12 +348,12 @@ func spHandlerOpen(portname string, baud int, buftype string) {
348348
}
349349

350350
func spHandlerClose(p *serport) {
351-
p.isClosing = true
352351
h.broadcastSys <- []byte("Closing serial port " + p.portConf.Name)
353-
spCloseReal(p)
352+
p.Close()
354353
}
355354

356-
func spCloseReal(p *serport) {
355+
func (p *serport) Close() {
356+
p.isClosing = true
357357
p.bufferwatcher.Close()
358358
p.portIo.Close()
359359
serialPorts.MarkPortAsClosed(p.portName)

0 commit comments

Comments
 (0)