From 4388747fb40526cf171a0c4fc4b8311d5c575b7d Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 15 Jun 2000 20:31:35 +0000 Subject: [PATCH] If IMAP command doesn't complete normally, close the connection. --- v7/src/imail/imail-imap.scm | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index d97b0728d..ac41749bb 100644 --- a/v7/src/imail/imail-imap.scm +++ b/v7/src/imail/imail-imap.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-imap.scm,v 1.119 2000/06/15 20:04:54 cph Exp $ +;;; $Id: imail-imap.scm,v 1.120 2000/06/15 20:31:35 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -1335,18 +1335,28 @@ (condition-accessor condition-type:imap-server-error 'RESPONSE)) (define (imap:command connection command . arguments) - (handle-broken-pipe - (lambda (condition) - condition - (close-imap-connection connection) - (error "Connection to IMAP server broken; please try again.")) - (lambda () - (imap:wait-for-tagged-response - connection - (imap:send-command connection command arguments) - (if (eq? command 'UID) - (car arguments) - command))))) + (let ((finished? #f)) + (dynamic-wind + (lambda () unspecific) + (lambda () + (let ((v + (handle-broken-pipe + (lambda (condition) + condition + (close-imap-connection connection) + (error "Connection to IMAP server broken; please try again.")) + (lambda () + (imap:wait-for-tagged-response + connection + (imap:send-command connection command arguments) + (if (eq? command 'UID) + (car arguments) + command)))))) + (set! finished? #t) + v)) + (lambda () + (if (not finished?) + (close-imap-connection connection)))))) (define (start-imap-trace pathname) (stop-imap-trace) -- 2.25.1