msg: cope with aggregated requests
This commit is contained in:
parent
5270b53209
commit
3e9e39f774
@ -49,7 +49,7 @@ class HandleClientConnectionThread(threading.Thread):
|
|||||||
|
|
||||||
buffer_data += data
|
buffer_data += data
|
||||||
|
|
||||||
if len(buffer_data) == self.msg_size:
|
if len(buffer_data) >= self.msg_size:
|
||||||
stop_time = datetime.datetime.now()
|
stop_time = datetime.datetime.now()
|
||||||
if start_time:
|
if start_time:
|
||||||
self.delays.append(stop_time - start_time)
|
self.delays.append(stop_time - start_time)
|
||||||
@ -57,11 +57,7 @@ class HandleClientConnectionThread(threading.Thread):
|
|||||||
response = string_generator(size=self.msg_size, chars=string.digits)
|
response = string_generator(size=self.msg_size, chars=string.digits)
|
||||||
start_time = datetime.datetime.now()
|
start_time = datetime.datetime.now()
|
||||||
self.connection.sendall(response.encode(ENCODING))
|
self.connection.sendall(response.encode(ENCODING))
|
||||||
buffer_data = ""
|
buffer_data = buffer_data[self.msg_size:]
|
||||||
|
|
||||||
elif len(buffer_data) > self.msg_size:
|
|
||||||
print("Too much data; break")
|
|
||||||
break
|
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
# Clean up the connection
|
# Clean up the connection
|
||||||
|
Loading…
Reference in New Issue
Block a user