SMTPServer.__init__(): The asyncore.dispatcher base class has a method

set_reuse_addr() that does the setsockopt fiddling.  Use it instead.
This commit is contained in:
Barry Warsaw 2001-10-09 15:46:31 +00:00
parent 6959a2fcd7
commit 93a6327adf

View File

@ -277,9 +277,7 @@ class SMTPServer(asyncore.dispatcher):
asyncore.dispatcher.__init__(self)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
# try to re-use a server port if possible
self.socket.setsockopt(
socket.SOL_SOCKET, socket.SO_REUSEADDR,
self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1)
self.set_reuse_addr()
self.bind(localaddr)
self.listen(5)
print >> DEBUGSTREAM, \