Skip to content

Commit e4a8c0e

Browse files
committed
🧵 Short-circuit logout state transition
Eventually the states will store small bits of information about each state on the state objects, e.g: which mailbox was selected or what caused the logout. So for `logout`, the first attempt wins and shouldn't be overwritten. For other states, like `selected`, the last attempt _should_ win. On the other hand, state transitions should be reworked so that: * state transitioning commands cannot run simultaneously * all state transitions are effected _inside_ the receiver thread
1 parent 0c919fb commit e4a8c0e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/net/imap.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3811,7 +3811,9 @@ def state_unselected!
38113811
end
38123812

38133813
def state_logout!
3814+
return true if connection_state in [:logout, *]
38143815
synchronize do
3816+
return true if connection_state in [:logout, *]
38153817
@connection_state = ConnectionState::Logout.new
38163818
end
38173819
end

0 commit comments

Comments
 (0)