193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
# storing fileno
self._fileno = fd.fileno()
# creating interface
self._io = io.FileIO(self._fileno, 'w', closefd)
# using empty tail
self._tail = None
# putting file to nonblocking mode
fcntl.fcntl(self._fileno, fcntl.F_SETFL, fcntl.fcntl(self._fileno, fcntl.F_GETFL) | os.O_NONBLOCK)
def __del__(self):
# purge queue before deleting
if not self.empty():
self.join()
def put(self, item, block=True, timeout=None):
|
|
|
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
# storing fileno
self._fileno = fd.fileno()
# creating interface
self._io = io.FileIO(self._fileno, 'w', closefd)
# using empty tail
self._tail = None
# putting file to nonblocking mode
fcntl.fcntl(self._fileno, fcntl.F_SETFL, fcntl.fcntl(self._fileno, fcntl.F_GETFL) | os.O_NONBLOCK)
def __del__(self):
# purge queue before deleting
if not self.empty():
self.join()
def put(self, item, block=True, timeout=None):
|
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
class Checker(object):
__slots__ = frozenset(['_db', '_log', '_queue', '_request', '_stdout'])
def __init__(self, queue, logger):
self._db = tagDB()
self._log = logger
self._log.info('started')
self._request = re.compile('^([0-9]+)\ (http|ftp):\/\/([-\w.:]+)\/([^ ]*)\ ([0-9.]+)\/(-|[\w\.]+)\ (-|\w+)\ (-|GET|HEAD|POST).*$')
self._queue = queue
self._stdout = FWritelineQueue(sys.stdout, False)
def process(self, id, site, ip_address, url_path, line = None):
#self._log.info('trying {}'.format(site))
result = self._db.check(site, ip_address)
reply = None
|
|
|
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
class Checker(object):
__slots__ = frozenset(['_db', '_log', '_queue', '_request', '_stdout'])
def __init__(self, queue, logger):
self._db = tagDB()
self._log = logger
self._log.info('started')
self._request = re.compile('^([0-9]+)\ (http|ftp):\/\/([-\w.:]+)\/([^ ]*)\ ([0-9.:]+)\/(-|[\w\.]+)\ (-|\w+)\ (-|GET|HEAD|POST).*$')
self._queue = queue
self._stdout = FWritelineQueue(sys.stdout, False)
def process(self, id, site, ip_address, url_path, line = None):
#self._log.info('trying {}'.format(site))
result = self._db.check(site, ip_address)
reply = None
|