Ticket #11: mailsink.patch

File mailsink.patch, 0.8 kB (added by amcgregor, 1 year ago)

Received patch from fs via TurboGears mailing list.

  • tests/lib/smtp_mailsink.py

     
    4444version = '1.0.1' 
    4545 
    4646import asyncore 
     47import select 
     48import errno 
    4749import copy 
    4850import smtpd 
    4951import threading 
     
    115117        def run(self): 
    116118                "Just run in a loop until stop() is called." 
    117119                while not self.stop_event.isSet(): 
    118                         asyncore.loop(timeout=0.1) 
     120                        try: 
     121                                asyncore.loop(timeout=0.1) 
     122                        except select.error, e: 
     123                                if e.args[0] != errno.EBADF: 
     124                                        raise 
    119125 
    120126        def stop(self, timeout_seconds=5.0): 
    121127                """Stop the mailsink and shut down this thread. timeout_seconds