Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
Check for session errors in attachLink
Browse files Browse the repository at this point in the history
Previously attachLink did not check for session level errors, causing
link attachment to block forever in the case of an error. This change
resolves that and properly returns the error to the caller.
  • Loading branch information
vcabbage committed Apr 3, 2018
1 parent 7ff5617 commit fba4c61
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,15 +729,15 @@ func attachLink(s *Session, r *Receiver, opts []LinkOption) (*link, error) {

// request handle from Session.mux
select {
case <-s.conn.done:
return nil, s.conn.getErr()
case <-s.done:
return nil, s.err
case s.allocateHandle <- l:
}

// wait for handle allocation
select {
case <-s.conn.done:
return nil, s.conn.getErr()
case <-s.done:
return nil, s.err
case <-l.rx:
}

Expand Down Expand Up @@ -773,8 +773,8 @@ func attachLink(s *Session, r *Receiver, opts []LinkOption) (*link, error) {
// wait for response
var fr frameBody
select {
case <-s.conn.done:
return nil, s.conn.getErr()
case <-s.done:
return nil, s.err
case fr = <-l.rx:
}
debug(3, "RX: %s", fr)
Expand Down

0 comments on commit fba4c61

Please sign in to comment.