Skip to content

Commit

Permalink
bug fix in main receive loop (#85)
Browse files Browse the repository at this point in the history
before fix goroutine did not finish after TCP connection was closed

Fixes: #84
  • Loading branch information
ksproska authored Nov 11, 2024
1 parent 497e3b4 commit 059ddfd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion session.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@ func (s *Session) recvMsg() error {
// interleaved messages (like notifications).
func (s *Session) recv() {
var err error
var opErr *net.OpError

for {
err = s.recvMsg()
if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) {
if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) || errors.As(err, &opErr) {
break
}
if err != nil {
Expand Down

0 comments on commit 059ddfd

Please sign in to comment.