From: Gaute B Strokkenes <gs234@cam.ac.uk>
Subject: Re: nnimap versus tls
Date: Mon, 07 Jul 2003 08:26:17 +0100 [thread overview]
Message-ID: <873chiiyqu.fsf@cam.ac.uk> (raw)
In-Reply-To: <848yraamxb.fsf@lucy.is.informatik.uni-duisburg.de> (Kai =?iso-8859-1?q?Gro=DFjohann's?= message of "Mon, 07 Jul 2003 08:08:48 +0200")
On 7 jul 2003, kai.grossjohann@gmx.net wrote:
> Gaute B Strokkenes <gs234@cam.ac.uk> writes:
>
>> I believe that what is going on is that in one iteration of the
>> loop, we receive the server's last bit of output after
>> accept-process-output has returned, but before we test the loop
>> condition. That way, (process-status imap-process) will be 'exit;
>> but there will still be output waiting for us that we haven't taken
>> care of yet. Everything will appear to work swimmingly until Emacs
>> is about to idle, and it checks for process output again.
>
> Okay, then another accept-process-output after the loop ought to
> take care of it. Right?
>
> Gnah. I feel so silly with this stupid kind of advice :-/
> I wished I grokked this.
As do I. However, your advice seems to work. With the following
imap-wait-for-tag:
(defun imap-wait-for-tag (tag &optional buffer)
; (message "imap: waiting for tag `%s'" tag)
(with-current-buffer (or buffer (current-buffer))
(gs234-debug (format "imap: START wait for tag `%s'" tag))
(gs234-debug (format "imap: imap-reached-tag is already: `%s'"
imap-reached-tag))
(let (imap-have-messaged)
(while (and (null imap-continuation)
(memq (process-status imap-process) '(open run))
(< imap-reached-tag tag))
(gs234-debug "imap: going through body of loop")
(let ((len (/ (point-max) 1024))
message-log-max)
(unless (< len 10)
(setq imap-have-messaged t)
(message "imap read: %dk" len))
(accept-process-output imap-process
(truncate imap-read-timeout)
(truncate (* (- imap-read-timeout
(truncate imap-read-timeout))
1000)))))
(when (and (null imap-continuation)
(< imap-reached-tag tag))
(gs234-debug "imap: accepting a bit extra...")
(accept-process-output imap-process
(truncate imap-read-timeout)
(truncate (* (- imap-read-timeout
(truncate imap-read-timeout))
1000)))
(gs234-debug "imap: ...done accepting a bit extra"))
(when imap-have-messaged
(message ""))
(gs234-debug (format "imap: END wait for tag `%s'" tag))
(gs234-debug (format "imap: imap-reached-tag is now: `%s'" imap-reached-tag))
(gs234-debug (format "imap: imap-continuation is now: `%s'" imap-continuation))
(gs234-debug (format "imap: (process-status imap-process) is now: `%s'"
(process-status imap-process)))
(and (memq (process-status imap-process) '(open run))
(or (assq tag imap-failed-tags)
(progn
(if imap-continuation
'INCOMPLETE
'OK)))))))
I get:
6 LOGOUT
imap: START wait for tag `6'
imap: imap-reached-tag is already: `5'
imap: going through body of loop
imap: going through body of loop
imap: going through body of loop
imap: going through body of loop
imap: going through body of loop
imap: going through body of loop
imap: going through body of loop
imap: accepting a bit extra...
IAF: trying to grab buffer ` *imap source*', proc `imap<1>'
* BYE kern.srcf.societies.cam.ac.uk IMAP4rev1 server terminating connection
6 OK LOGOUT completed
*** Received corrupted data(-9) - server has terminated the connection abnormally
IAF: imap-state is `auth'
IAF: punting on imap-parse-response...
IAF: imap-state is `auth'
IAF: punting on imap-parse-response...
imap: ...done accepting a bit extra
imap: END wait for tag `6'
imap: imap-reached-tag is now: `6'
imap: imap-continuation is now: `nil'
imap: (process-status imap-process) is now: `exit'
imap: ...closing now done
So we seem to have guessed correctly at last. ^_^
I'll prepare a (nicer-looking) patch...
--
Big Gaute http://www.srcf.ucam.org/~gs234/
Is something VIOLENT going to happen to a GARBAGE CAN?
next prev parent reply other threads:[~2003-07-07 7:26 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-19 13:32 Gaute B Strokkenes
2003-07-02 23:46 ` Gaute B Strokkenes
2003-07-04 18:24 ` Kai Großjohann
2003-07-05 8:44 ` Gaute B Strokkenes
2003-07-05 12:53 ` Kai Großjohann
2003-07-06 12:56 ` Gaute B Strokkenes
2003-07-06 15:54 ` Kai Großjohann
2003-07-06 21:53 ` Gaute B Strokkenes
2003-07-07 6:08 ` Kai Großjohann
2003-07-07 7:26 ` Gaute B Strokkenes [this message]
2003-07-07 9:46 ` Gaute B Strokkenes
2003-07-07 15:35 ` Kai Großjohann
2003-07-08 22:20 ` Gaute B Strokkenes
2003-07-09 19:46 ` Kai Großjohann
2003-07-10 0:03 ` Gaute B Strokkenes
2003-07-09 19:52 ` Kai Großjohann
2003-07-10 1:25 ` Gaute B Strokkenes
2003-07-10 7:24 ` Kai Großjohann
2003-07-10 10:32 ` Gaute B Strokkenes
2003-07-10 7:49 ` Simon Josefsson
2003-07-10 11:42 ` Gaute B Strokkenes
2003-07-10 12:13 ` Simon Josefsson
2003-07-10 13:16 ` Matthias Andree
2003-07-07 15:38 ` Kai Großjohann
2003-07-07 19:37 ` Gaute B Strokkenes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873chiiyqu.fsf@cam.ac.uk \
--to=gs234@cam.ac.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).