Skip to content

Commit

Permalink
bug fix in failover server, only error out if io error
Browse files Browse the repository at this point in the history
  • Loading branch information
xiegeo committed Feb 2, 2019
1 parent 5a76c42 commit adb53db
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions failover.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (s *FailoverSerialConn) serverRead(b []byte) (int, error) {
}
n, err := s.PacketReader.Read(b)
if err != nil {
return n, err
return n, err //only real io errors are exposed
}
s.lock.Lock()
locked = true
Expand All @@ -115,7 +115,9 @@ func (s *FailoverSerialConn) serverRead(b []byte) (int, error) {
pdu, err := rtu.GetPDU()
if err != nil {
debugf("failover serverRead internal GetPDU error : %v", err)
return n, err //bubbles formate up errors
s.misses = 0
debugf("reset misses\n")
continue //throw away and read again
}
if rtu[0] == 0 {
//zero slave id do not have a reply, so we won't expect one
Expand Down

0 comments on commit adb53db

Please sign in to comment.