Skip to content

Commit 29cd0c5

Browse files
committed
♻️ Join the receiver _after_ closing the socket
The reciever thread should close the connection before it finishes, and `@sock.shutdown` should've been enough to trigger that. But this ensures the socket is closed right away, without needing to wait on whatever the receiver thread might be in the middle of doing.
1 parent 286f757 commit 29cd0c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/net/imap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,10 +1131,10 @@ def disconnect
11311131
rescue Exception => e
11321132
@receiver_thread.raise(e)
11331133
end
1134-
@receiver_thread.join
11351134
synchronize do
11361135
@sock.close
11371136
end
1137+
@receiver_thread.join
11381138
raise e if e
11391139
ensure
11401140
# Try again after shutting down the receiver thread. With no reciever

0 commit comments

Comments
 (0)