Skip to content

Commit e7a6678

Browse files
committed
♻️ Tweak connection state change in receiver thread
This pushes `ensure state_logout!` from the receiver's `Thread.start` down into `#receive_responses`. As a side-effect, this also pulls the state change inside the receiver thread's exception handling. But that's fine: it fits better inside `receive_responses`, and `state_logout!` really should never raise an exception anyway.
1 parent 29cd0c5 commit e7a6678

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/net/imap.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3350,8 +3350,6 @@ def start_receiver_thread
33503350
rescue Exception => ex
33513351
@receiver_thread_exception = ex
33523352
# don't exit the thread with an exception
3353-
ensure
3354-
state_logout!
33553353
end
33563354
end
33573355

@@ -3433,6 +3431,8 @@ def receive_responses
34333431
@idle_done_cond.signal
34343432
end
34353433
end
3434+
ensure
3435+
state_logout!
34363436
end
34373437

34383438
def get_tagged_response(tag, cmd, timeout = nil)

0 commit comments

Comments
 (0)