Skip to content

Commit 9becbf1

Browse files
committed
🧵 Don't lock around socket close in #disconnect
It should always be safe to call `@sock.close` without external synchronization. And synchronizing here with could get stuck waiting e.g. for a response_handler looping in the receiver thread.
1 parent 5bddf68 commit 9becbf1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/net/imap.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,9 +1151,7 @@ def disconnect
11511151
rescue Exception => e
11521152
@receiver_thread.raise(e)
11531153
end
1154-
synchronize do
1155-
@sock.close
1156-
end
1154+
@sock.close
11571155
@receiver_thread.join
11581156
raise e if e
11591157
ensure

0 commit comments

Comments
 (0)