Skip to content

Commit

Permalink
fix(plc4go/codegen): Truly close connection (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongjinlin committed Mar 31, 2022
1 parent 48839ac commit 5cda65f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plc4go/internal/plc4go/spi/default/DefaultConnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,11 @@ func (d *defaultConnection) BlockingClose() {

func (d *defaultConnection) Close() <-chan plc4go.PlcConnectionCloseResult {
log.Trace().Msg("close connection")
err := d.GetTransportInstance().Close()
d.SetConnected(false)
ch := make(chan plc4go.PlcConnectionCloseResult)
go func() {
ch <- NewDefaultPlcConnectionCloseResult(d.GetConnection(), nil)
ch <- NewDefaultPlcConnectionCloseResult(d.GetConnection(), err)
}()
return ch
}
Expand Down

0 comments on commit 5cda65f

Please sign in to comment.