Skip to content

Commit

Permalink
fixed #12672 / refs #12671 - donate-cpu-server.py: increased buffers …
Browse files Browse the repository at this point in the history
…for data reading / some minor fixes (#6358)
  • Loading branch information
firewave authored Apr 29, 2024
1 parent e4f7087 commit 05d5710
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/donate-cpu-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
# changes)
SERVER_VERSION = "1.3.50"
SERVER_VERSION = "1.3.51"

OLD_VERSION = '2.14.0'

Expand Down Expand Up @@ -1221,7 +1221,7 @@ def read_data(connection, cmd, pos_nl, max_data_size, check_done, cmd_name, time
bytes_received = connection.recv(1024)
if bytes_received:
try:
text_received = bytes_received.decode('utf-8', 'ignore')
text_received = bytes_received.decode('ascii', 'ignore')
except UnicodeDecodeError as e:
print_ts('Error: Decoding failed ({}): {}'.format(cmd_name, e))
data = None
Expand All @@ -1243,7 +1243,7 @@ def read_data(connection, cmd, pos_nl, max_data_size, check_done, cmd_name, time
print_ts('Timeout occurred ({}).'.format(cmd_name))
data = None

if data and (len(data) >= (max_data_size + 1024)):
if data and (len(data) >= max_data_size):
print_ts('Maximum allowed data ({} bytes) exceeded ({}).'.format(max_data_size, cmd_name))
data = None

Expand Down Expand Up @@ -1321,7 +1321,7 @@ def server(server_address_port: int, packages: list, packageIndex: int, resultPa
connection.close()
continue
elif cmd.startswith('write\nftp://') or cmd.startswith('write\nhttp://'):
data = read_data(connection, cmd, pos_nl, max_data_size=2 * 1024 * 1024, check_done=True, cmd_name='write')
data = read_data(connection, cmd, pos_nl, max_data_size=2.5 * 1024 * 1024, check_done=True, cmd_name='write')
if data is None:
continue

Expand Down Expand Up @@ -1376,7 +1376,7 @@ def server(server_address_port: int, packages: list, packageIndex: int, resultPa
generate_package_diff_statistics(filename)
continue
elif cmd.startswith('write_info\nftp://') or cmd.startswith('write_info\nhttp://'):
data = read_data(connection, cmd, pos_nl, max_data_size=1024 * 1024, check_done=True, cmd_name='write_info')
data = read_data(connection, cmd, pos_nl, max_data_size=7 * 1024 * 1024, check_done=True, cmd_name='write_info')
if data is None:
continue

Expand Down

0 comments on commit 05d5710

Please sign in to comment.