From 5ae1b6d865165ebdbbb39db6ff28d51992ae108e Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Sat, 8 Jul 2017 06:52:17 +0200 Subject: [PATCH] Asyncore update: remove obsolete files --- src/network/downloadqueue.py | 12 ------- src/network/uploadqueue.py | 70 ------------------------------------ 2 files changed, 82 deletions(-) delete mode 100644 src/network/downloadqueue.py delete mode 100644 src/network/uploadqueue.py diff --git a/src/network/downloadqueue.py b/src/network/downloadqueue.py deleted file mode 100644 index 3789fb19..00000000 --- a/src/network/downloadqueue.py +++ /dev/null @@ -1,12 +0,0 @@ -#import collections -from threading import current_thread, enumerate as threadingEnumerate, RLock -import Queue -import time - -#from helper_sql import * -from singleton import Singleton - -@Singleton -class DownloadQueue(Queue.Queue): - # keep a track of objects that have been advertised to us but we haven't downloaded them yet - maxWait = 300 diff --git a/src/network/uploadqueue.py b/src/network/uploadqueue.py deleted file mode 100644 index 5d699e96..00000000 --- a/src/network/uploadqueue.py +++ /dev/null @@ -1,70 +0,0 @@ -from collections import namedtuple -import Queue -import random -from threading import current_thread, enumerate as threadingEnumerate, RLock -import time - -#from helper_sql import * -from singleton import Singleton - -UploadElem = namedtuple("UploadElem", "stream identifier") - -class UploadQueueDeadlineException(Exception): - pass - - -class UploadQueue(object): - queueCount = 10 - - def __init__(self): - self.queue = [] - self.lastGet = 0 - self.getIterator = 0 - for i in range(UploadQueue.queueCount): - self.queue.append([]) - - def put(self, item): - self.queue[random.randrange(0, UploadQueue.queueCount)].append(item) - - def get(self): - i = UploadQueue.queueCount - retval = [] - while self.lastGet < time.time() - 1 and i > 0: - if len(self.queue) > 0: - retval.extend(self.queue[self.getIterator]) - self.queue[self.getIterator] = [] - self.lastGet += 1 - # only process each queue once - i -= 1 - self.getIterator = (self.getIterator + 1) % UploadQueue.queueCount - if self.lastGet < time.time() - 1: - self.lastGet = time.time() - return retval - - def streamElems(self, stream): - retval = {} - for q in self.queue: - for elem in q: - if elem.stream == stream: - retval[elem.identifier] = True - return retval - - def len(self): - retval = 0 - for i in range(UploadQueue.queueCount): - retval += len(self.queue[i]) - return retval - - def stop(self): - for i in range(UploadQueue.queueCount): - self.queue[i] = [] - - -@Singleton -class AddrUploadQueue(UploadQueue): - pass - - -@Singleton -class ObjUploadQueue(UploadQueue): - pass