Subject: Re: Total refresh of the stream

From: Jess Nielsen <[email-masked]>
Date: Wed, 12 Nov 2003 15:30:03 +0100

>> My problem is that I have to different sessions 
>> accessing the same mailbox.
> There is almost no legitimate reason to do that. 
> IMAP is not HTTP.

If two users are sharing the same mailbox (read: each 
of them starts the app and use the same user) then you will have this 
setup. 

> mail_ping(), or in extreme circumstances mail_check(), 
> is all that you need to ensure that both sessions 
> are in sync.

I did already try both mail_ping() and mail_check() without any luck.

Regards,
Jess

---

From: Mark Crispin <[email-masked]>
Date: Wed, 12 Nov 2003 08:49:28 -0600 (Central Standard Time)

> of them starts the app and use the same user) then you will have this

That's why I said "almost no legitimate reason" instead of "no legitimate
reason."  The case you mentioned is one of the few exceptions.

Note, however, that if the mail store does not support simultaneous
access, then you can't do this.  If two users attempt to do this, the
result is that one user will win and one user will lose.  The only answer
in that situation is "don't do it."

> I did already try both mail_ping() and mail_check() without any luck.

If the mail store supports shared access (e.g. UW imapd with mbx format,
Cyrus server), then mail_ping() or mail_check() is all that is needed.

If the mail store does not support shared access (e.g. UW imapd with
traditional UNIX format), then either the second session was denied or the
first session was closed (and the stream is dead; this is what UW imapd
does with traditional UNIX format).  The recovery for the latter "last
session wins" behavior is to re-open the session and forget everything
that you knew about the previous session; that in turn will cause the
other session to get killed which means that it'll have to recover by
re-opening which will kill....  [See the problem?  Hence the answer of
"don't do it"...]

One of the above two scenarios will apply to all compliant servers.

If neither of these situations seems to apply, then perhaps you are using
a non-compliant server.  In that case, the answer is "don't use that
server"; or, if you prefer, "there's no hope of winning with a broken
server."  Which server are you using?

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.