From 7c54483dffe17585ddaa71c9490c4bfb8609dcb7 Mon Sep 17 00:00:00 2001 From: yvesf Date: Sat, 20 Feb 2010 20:35:58 +0100 Subject: fix previous mistake, better logging --- smtp.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'smtp.py') diff --git a/smtp.py b/smtp.py index 3be3d63..1f50884 100644 --- a/smtp.py +++ b/smtp.py @@ -63,14 +63,17 @@ class SMTPServer(asyncore.dispatcher): def handle_accept(self): conn, addr = self.accept() - self.logger.info("New Client %s" % addr) - SMTPChannel(self, conn, addr) + self.logger.info("New Client %s:%s" % conn.getpeername()) + try: + SMTPChannel(self, conn, addr) + except Exception,e: + self.logger.error(str(e)) if __name__ == '__main__': s = SMTPServer() - + #user change pwinfo = pwd.getpwnam('nobody') os.setregid(pwinfo[3],pwinfo[3]) @@ -106,5 +109,6 @@ if __name__ == '__main__': os.dup2(se.fileno(), sys.stderr.fileno()) # Set custom file descriptors so that they get proper buffering. sys.stdout, sys.stderr = so, se - + #""" + asyncore.loop() -- cgit v1.2.1