TOA通讯失败时,关闭连接

This commit is contained in:
刘祥超
2021-06-27 17:31:10 +08:00
parent 12f3916e45
commit 0e912b79cd

View File

@@ -86,6 +86,7 @@ func (this *TOAManager) SendMsg(msg string) error {
if this.conn != nil { if this.conn != nil {
_, err := this.conn.Write([]byte(msg + "\n")) _, err := this.conn.Write([]byte(msg + "\n"))
if err != nil { if err != nil {
_ = this.conn.Close()
this.conn = nil this.conn = nil
} }
return err return err