diff options
| author | bwarsaw | 1999-12-13 23:34:50 +0000 |
|---|---|---|
| committer | bwarsaw | 1999-12-13 23:34:50 +0000 |
| commit | b4f808e10ef3118b61746ee1b3425487b107c099 (patch) | |
| tree | 1fefbf474bff7ff8948727dc4d3f0b126cf444bd /cron | |
| parent | 69b573eca309adc44f4c68f0807f6f40f434250d (diff) | |
| download | mailman-b4f808e10ef3118b61746ee1b3425487b107c099.tar.gz mailman-b4f808e10ef3118b61746ee1b3425487b107c099.tar.zst mailman-b4f808e10ef3118b61746ee1b3425487b107c099.zip | |
Be sure to close the NNTP connection so we don't leak file descriptors
Diffstat (limited to 'cron')
| -rwxr-xr-x | cron/gate_news | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/cron/gate_news b/cron/gate_news index 8e3649cdd..ece84ab18 100755 --- a/cron/gate_news +++ b/cron/gate_news @@ -57,19 +57,6 @@ from Mailman import LockFile from Mailman import Message from Mailman.Logging.Utils import LogStdErr -# TBD: Duplicates functionality in scripts/driver. This should be -# re-evaluated when we require Python 1.5.2. -# -# pre-load the `cgi' module. we do this because we're distributing a slightly -# different version than the standard Python module. it's essentially Python -# 1.5.2's module, with an experimental patch to handle clients that give bogus -# or non-existant content-type headers. -# -# we assign sys.modules['cgi'] to this special cgi module so any other module -# that tries to import cgi will get our special one -import Mailman.pythonlib.cgi -sys.modules['cgi'] = Mailman.pythonlib.cgi - # Work around known problems with some RedHat cron daemons import signal signal.signal(signal.SIGCHLD, signal.SIG_DFL) @@ -118,6 +105,7 @@ def main(): # number actually gated children = {} # cruise through lists + conn = None for name in names: # check to see if the list is gating news to mail. If not, skip the # list. If so, then we have to poll the newsgroup and gate any @@ -131,6 +119,9 @@ def main(): # child process, so we do need to open up a new connection for each # list. try: + # close the previous NNTP connection + if conn: + conn.quit() conn = nntplib.NNTP(mlist.nntp_host) except socket.error, e: # couldn't open a socket to the NNTP host. maybe we've got too @@ -223,6 +214,8 @@ def main(): reap(children, watermarks) # we're done forking off all the gating children, now just wait for them # all to exit, and then we're done + if conn: + conn.quit() while children: reap(children, watermarks) |
