From 30166f64162978234573cdd42b24b7db9da8dccc Mon Sep 17 00:00:00 2001 From: Fierelier Date: Thu, 16 Dec 2021 08:36:42 +0100 Subject: [PATCH] Remove old threaded stuff from client --- client.py | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/client.py b/client.py index 6826be8..e27d706 100644 --- a/client.py +++ b/client.py @@ -20,52 +20,13 @@ sp = pUp(s) # script start import subprocess import socket -import threading -import queue def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) bufferSize = 8096 # buffer size in bytes -queueLengthWait = 10 # How many buffers can be in the queue before waiting for it to empty? 0 for infinite, maxAccumulatedData comes into play. Raise for smoother playback, lower for less delay. -maxAccumulatedData = 50*1000*1000 # If queueLengthWait is 0, how much data can be in an outbound thread's queue at maximum before the connection is closed? timeout = 15 # timeout in seconds connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -class stdoutThread(threading.Thread): - def __init__(self): - threading.Thread.__init__(self) - self.queue = queue.Queue() - - def run(self): - while True: - data = self.queue.get(timeout=timeout) - sys.stdout.buffer.write(data) - -class stdinThread(threading.Thread): - def __init__(self,connection): - threading.Thread.__init__(self) - self.queue = queue.Queue(queueLengthWait) - self.connection = connection - - def run(self): - try: - while True: - accumulatedData = self.queue.qsize() * bufferSize - - if queueLengthWait < 1: - eprint("Accumulated MB: " +str(accumulatedData/1000000)) - - if accumulatedData > maxAccumulatedData: - eprint("Accumulated data limit reached. Closing.") - self.connection.close() - self.queue = False - return - data = self.queue.get() - self.connection.sendall(data) - except: - self.connection.close() - self.queue = False - raise def listToCommand(lst): cmd = ""