Opened 12 years ago

Last modified 12 years ago

#765 enhancement closed fixed (fixed)

Added Timeout checking to IMAP4Client

Reported by: bkirsch Owned by:
Priority: normal Milestone:
Component: Keywords:
Cc: exarkun, bkirsch Branch:
Author:

Description


Attachments (5)

imap4.diff (1.3 KB) - added by bkirsch 12 years ago.
imap4.2.diff (2.1 KB) - added by bkirsch 12 years ago.
imap4.3.diff (2.6 KB) - added by bkirsch 12 years ago.
test_imap.diff (1.8 KB) - added by bkirsch 12 years ago.
imap4.4.diff (2.6 KB) - added by bkirsch 12 years ago.

Download all attachments as: .zip

Change History (14)

Changed 12 years ago by bkirsch

comment:1 Changed 12 years ago by bkirsch

The IMAP4Client will hang if the server stop returning responses. Added timeout
to prevent this from 
happening. By default the timeout is set to 0 which means no timeout checking
will be performed. 
Set timeout to >0 for the feature to be active. This prevents unexpected
behavior from current 
IMAP4Client users.

comment:2 Changed 12 years ago by exarkun

This patch causes the client to disconnect, but it doesn't do anything with any
outstanding Deferreds.  These should all have their errbacks invoked with a
timeout exception of some sort.

Also, rawDataReceived needs to call resetTimeout, like lineReceived does, since
during message body receipt, lineReceived will not be invoked.

Unit tests would be great, too.

Changed 12 years ago by bkirsch

comment:3 Changed 12 years ago by bkirsch

Updated Diff that adds a timeout for rawDataReceived and errbacks any deferred commands in the 
self.queued buffer

Changed 12 years ago by bkirsch

comment:4 Changed 12 years ago by bkirsch

Ok here is the final imap4.py diff.

Changed 12 years ago by bkirsch

comment:5 Changed 12 years ago by bkirsch

Ok here is the test_imap.py test case diff

Changed 12 years ago by bkirsch

comment:6 Changed 12 years ago by bkirsch

Added a check to make sure the lastCmd deferred has not already been called :)

comment:7 Changed 12 years ago by exarkun

Committed at revision 

I made a couple minor changes to the patch before committing.  Most notably, I
suspect, I removed the string from the TimeoutError() constructor.  I think a
user-friendly messages belongs somewhere else.

comment:8 Changed 12 years ago by exarkun

Committed at revision 12474

I made a couple minor changes to the patch before committing.  Most notably, I
suspect, I removed the string from the TimeoutError() constructor.  I think a
user-friendly messages belongs somewhere else.

comment:9 Changed 6 years ago by <automation>

  • Owner exarkun deleted
Note: See TracTickets for help on using tickets.