Skip to content

Commit

Permalink
chore: Improve failed CALL error
Browse files Browse the repository at this point in the history
Change-Id: Ia628b45254da3c701fe386cd2ef77f849418f297
  • Loading branch information
andeya committed Jun 26, 2019
1 parent ba4c26d commit 05aecce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,9 +827,13 @@ func (c *callCmd) done() {
c.sess.graceCallCmdWaitGroup.Done()
}

func (c *callCmd) cancel() {
func (c *callCmd) cancel(reason string) {
c.sess.callCmdMap.Delete(c.output.Seq())
c.rerr = rerrConnClosed
if reason != "" {
c.rerr = rerrConnClosed.Copy().SetReason(reason)
} else {
c.rerr = rerrConnClosed
}
c.callCmdChan <- c
close(c.doneChan)
// free count call-launch
Expand Down
4 changes: 3 additions & 1 deletion session.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,10 @@ func (s *session) readDisconnected(oldConn net.Conn, err error) {

s.peer.sessHub.Delete(s.ID())

var reason string
if err != nil && err != socket.ErrProactivelyCloseSocket {
if errStr := err.Error(); errStr != "EOF" {
reason = errStr
Debugf("disconnect(%s) when reading: %T %s", s.RemoteAddr().String(), err, errStr)
}
}
Expand All @@ -705,7 +707,7 @@ func (s *session) readDisconnected(oldConn net.Conn, err error) {
callCmd := v.(*callCmd)
callCmd.mu.Lock()
if !callCmd.hasReply() && callCmd.rerr == nil {
callCmd.cancel()
callCmd.cancel(reason)
}
callCmd.mu.Unlock()
return true
Expand Down

0 comments on commit 05aecce

Please sign in to comment.