From b81ae322d38a6bab3af230a8018760302d3a4f86 Mon Sep 17 00:00:00 2001 From: calvin Date: Thu, 30 Mar 2000 18:22:12 +0000 Subject: [PATCH] See ChangeLog git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@54 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- ChangeLog | 1 + MANIFEST.in | 2 ++ linkcheck/Config.py | 21 ++++++++++++++++++++- linkcheck/NntpUrlData.py | 6 ++++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9113dceb..5dd724bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 30.3.2000 * support for NNTP news: links + * forgot to put lc.fcgi and lc.sz_fcgi in release 30.3.2000 Version 1.1.4 * fixed missing self.mime assignment in HttpUrlData.py diff --git a/MANIFEST.in b/MANIFEST.in index 2249c577..42574077 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,6 +5,8 @@ include TODO include linkchecker include linkchecker.bat include lc.cgi +include lc.fcgi +include lc.sz_fcgi include Makefile include create.sql include debian/rules diff --git a/linkcheck/Config.py b/linkcheck/Config.py index 5f10dfba..88ac6874 100644 --- a/linkcheck/Config.py +++ b/linkcheck/Config.py @@ -78,12 +78,17 @@ class Configuration(UserDict.UserDict): self.urlCache_has_key = self.urlCache_has_key_NoThreads self.urlCache_get = self.urlCache_get_NoThreads self.urlCache_set = self.urlCache_set_NoThreads + self.urlCacheLock = None self.robotsTxtCache_has_key = self.robotsTxtCache_has_key_NoThreads self.robotsTxtCache_get = self.robotsTxtCache_get_NoThreads self.robotsTxtCache_set = self.robotsTxtCache_set_NoThreads + self.robotsTxtCacheLock = None self.log_newUrl = self.log_newUrl_NoThreads + self.logLock = None self.urls = [] self.threader = None + self.connectNntp = self.connectNntp_NoThreads + self.dataLock = None def enableThreading(self, num): import Queue,Threader @@ -107,6 +112,8 @@ class Configuration(UserDict.UserDict): self.logLock = Lock() self.urls = Queue.Queue(0) self.threader = Threader.Threader(num) + self.connectNntp = self.connectNntp_Threads + self.dataLock = Lock() def hasMoreUrls_NoThreads(self): return len(self.urls) @@ -158,7 +165,19 @@ class Configuration(UserDict.UserDict): if not self.data["quiet"]: self.data["log"].endOfOutput() for log in self.data["fileoutput"]: log.endOfOutput() - + + def connectNntp_NoThreads(self): + if not self.data.has_key("nntp"): + import nntplib + self.data["nntp"] = nntplib.NNTP(self.data["nntpserver"]) + + def connectNntp_Threads(self): + if not self.data.has_key("nntp"): + import nntplib + self.dataLock.acquire() + self.data["nntp"] = nntplib.NNTP(self.data["nntpserver"]) + self.dataLock.release() + def hasMoreUrls_Threads(self): return not self.urls.empty() diff --git a/linkcheck/NntpUrlData.py b/linkcheck/NntpUrlData.py index dc24bcdb..fd84929b 100644 --- a/linkcheck/NntpUrlData.py +++ b/linkcheck/NntpUrlData.py @@ -1,4 +1,4 @@ -import nntplib,re,string +import re,string from HostCheckingUrlData import HostCheckingUrlData from UrlData import LinkCheckerException @@ -17,7 +17,9 @@ class NntpUrlData(HostCheckingUrlData): def checkConnection(self, config): if not config["nntpserver"]: self.setWarning("No NNTP server specified, checked only syntax") - nntp = nntplib.NNTP(config["nntpserver"]) + # only connect once + config.connectNntp() + nntp = config["nntp"] resp,count,first,last,name = nntp.group(self.host) self.setInfo("Group %s has %s articles, range %s to %s" % \ (name, count, first, last))