feat: Implement proper shutdown handling
- Dominant language
- Rust
- Stars
- 7
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Currently the proxy is ignoring all shutdown related messages of IMAP. Instead it waits for a stream error and then terminates. The stream error is logged on log level ERROR. That means that we log a message with ERROR even if the IMAP connection was properly shut down.
I think we should only log messages with ERROR if something unexpected happened. I can think of two possible solutions:
- ~~Match the stream error. If the stream was closed, log a message with INFO. If there was an I/O error, log the message with ERROR. The implementation is very easy.~~ (https://github.com/duesee/imap-next/pull/85)
- Match the IMAP message. If there is a BYE message or something similar, delegate it to the client and terminate the proxy. This is probably more complicated because we still need to wait until the message was sent to the client. Fortunately `ServerFlowEvent::ResponseSent` contains the `Response`.
Relevant question: How much should the proxy care for the IMAP messages it delegates? After all, it's just a proxy.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.