wasm-demo/demo/ermis-f/imap-protocol/cur/1600095126.22999.mbox:2,S

51 lines
2.2 KiB
Plaintext

MBOX-Line: From mrc at CAC.Washington.EDU Fri Jun 30 09:36:34 2006
To: imap-protocol@u.washington.edu
From: Mark Crispin <mrc@CAC.Washington.EDU>
Date: Fri Jun 8 12:34:37 2018
Subject: [Imap-protocol] IMAP disconnection
In-Reply-To: <etPan.44a548f0.6bad5e90.d87@utopia>
References: <etPan.44a548f0.6bad5e90.d87@utopia>
Message-ID: <Pine.OSX.4.64.0606300923160.408@pangtzu.panda.com>
On Fri, 30 Jun 2006, DINH Vi?t Ho? wrote:
> Is something will be breaking if we don't send the LOGOUT command ?
It's not a good idea.
(1) Some servers may perform a cleanup or checkpoint operation during
LOGOUT. Of course, the server will try to trap disconnect, and do the
checkpoint anyway in the trap handler. However, a few (thankfully, rare)
OS environments send mandatory (non-trappable) kills to servers on
disconnect. Thus, the disconnect can actually cause a loss of cleanups or
mailbox updates!
This is a real problem in some mailbox formats (e.g., traditional UNIX
mailbox format). It is very expensive to update the mailbox file, so flag
changes are deferred until a checkpoint.
(2) The server is going to log the disconnect as a non-LOGOUT session
termination event. It has no way of knowing that the client intended to
do this. This, in turn, leads to false bug reports.
> Is there a recommended behavior to adopt to avoid that problem ?
Yes. There is no reason why your client must block waiting for the server
to LOGOUT. All it has to do is send the LOGOUT command and defer closing
the TCP connection until the BYE and OK response comes back. In the
meantime, it can do something else.
In a multithreaded environment, the LOGOUT could be given to a thread.
Alternatively, the client can fork off another instance of itself
(invisible to the user), let the fork have the sockets and go off on its
own, and the parent fork which has the user interface forgets the sockets.
This way, the user sees an immediate termination, whereas behind the
curtain the funny man is busy pulling the levers and twirling the dials.
-- Mark --
http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.