mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-27 11:10:28 +00:00
no timeoutsocket
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@181 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
f2bd10e31b
commit
ce3eb27e1f
7 changed files with 10 additions and 25 deletions
10
README
10
README
|
|
@ -104,13 +104,3 @@ We call init() once to initialize the Logger. UrlData.check() calls
|
|||
newUrl() (through UrlData.logMe()) and after all checking we call
|
||||
endOfOutput(). Easy.
|
||||
New loggers are created with the Config.newLogger(name, fileoutput) function.
|
||||
|
||||
|
||||
Nifty features you did not expect
|
||||
---------------------------------
|
||||
o Included brain enhancer. Just read Python code to gain intelligence.
|
||||
o Wash-O-matic. LinkChecker has a secret option which washes all your
|
||||
dirty clothes in a matter of seconds.
|
||||
o Y10K-Compatibility(tm) guaranteed. Trust me on that one.
|
||||
o There is no spoon. Wake up already!
|
||||
|
||||
|
|
|
|||
4
TODO
4
TODO
|
|
@ -1,8 +1,6 @@
|
|||
High priority
|
||||
|
||||
o DNS (and some URLs) seem to hang sometimes. This is not entirely true.
|
||||
The SMTP connect has a very long timeout (>200 seconds).
|
||||
But I can not use the signal module with threads.
|
||||
o Use Python 2.0 features
|
||||
|
||||
o I want to be able to supply a "break" command even when multiple
|
||||
threads are running.
|
||||
|
|
|
|||
2
debian/changelog
vendored
2
debian/changelog
vendored
|
|
@ -4,8 +4,6 @@ linkchecker (1.2.6) unstable; urgency=low
|
|||
* configuration changes: distutils are now required; because of that
|
||||
we have no more .tmpl files
|
||||
* fix db name in create.sql
|
||||
* added timeoutsocket.py to supply a timeout for socket.connect()
|
||||
calls
|
||||
* fix tag parsing when a quoted tag attribute value contains a >
|
||||
character
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ class HTTPConnection:
|
|||
def connect(self):
|
||||
"""Connect to the host and port specified in __init__."""
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.sock.connect(self.host, self.port)
|
||||
self.sock.connect((self.host, self.port))
|
||||
|
||||
def close(self):
|
||||
"""Close the connection to the HTTP server."""
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class NntpUrlData(UrlData):
|
|||
timeout = 0
|
||||
except nntplib.error_perm:
|
||||
value = sys.exc_info()[1]
|
||||
debug("NNTP: "+value+"\n")
|
||||
debug("NNTP: %s\n" % value)
|
||||
if re.compile("^505").search(str(value)):
|
||||
import whrandom
|
||||
time.sleep(whrandom.randint(10,20))
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ if sys.version[:5] < "1.5.2":
|
|||
raise SystemExit, "This program requires Python 1.5.2 or later."
|
||||
import getopt,re,string,os,urlparse
|
||||
# 90 seconds timeout for all connections
|
||||
import timeoutsocket
|
||||
timeoutsocket.setDefaultSocketTimeout(90)
|
||||
#import timeoutsocket
|
||||
#timeoutsocket.setDefaultSocketTimeout(90)
|
||||
import linkcheck, StringUtil
|
||||
from linkcheck import _
|
||||
|
||||
|
|
|
|||
|
|
@ -147,9 +147,9 @@ class TimeoutSocket:
|
|||
self._timeout = timeout
|
||||
# end set_timeout
|
||||
|
||||
def connect(self, addr, port=None, dumbhack=None):
|
||||
def connect(self, addr, dumbhack=None):
|
||||
# In case we were called as connect(host, port)
|
||||
if port != None: addr = (addr, port)
|
||||
#if port != None: addr = (addr, port)
|
||||
|
||||
# Shortcuts
|
||||
sock = self._sock
|
||||
|
|
@ -221,10 +221,9 @@ class TimeoutSocket:
|
|||
|
||||
def send(self, data, flags=0):
|
||||
sock = self._sock
|
||||
timeout = self._timeout
|
||||
totallen = 0
|
||||
while data:
|
||||
r,w,e = select.select([],[sock], [], timeout)
|
||||
r,w,e = select.select([],[sock], [], self._timeout)
|
||||
if not w:
|
||||
raise Timeout("Send timed out")
|
||||
sentlen = sock.send(data, flags)
|
||||
|
|
@ -279,12 +278,12 @@ class TimeoutFile:
|
|||
break
|
||||
bufsize = self._bufsize
|
||||
if size > 0:
|
||||
bufsize = min(bufsize, size - datalen )
|
||||
bufsize = min(bufsize, size - datalen)
|
||||
buf = self.recv(bufsize)
|
||||
if not buf:
|
||||
break
|
||||
data = data + buf
|
||||
if size > 0 and datalen > size:
|
||||
if datalen > size > 0:
|
||||
self._sock._inqueue = data[size:]
|
||||
data = data[:size]
|
||||
return data
|
||||
|
|
|
|||
Loading…
Reference in a new issue