Skip to content

Commit

Permalink
Fixed high hash-reject rate
Browse files Browse the repository at this point in the history
  • Loading branch information
YeahNotSewerSide authored Apr 11, 2021
1 parent 0a3002c commit 709fe7e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Android_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ def start_job(dispatcher,event):
logger.debug(str(event.algorithm))
return

END_JOB = True

try:
calculation_thread.join()
except:
pass

EXPECTED_HASH = event.expectedHash
START_END = (event.start,event.end)

Expand Down
10 changes: 8 additions & 2 deletions cluster_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def __repr__(self):
server_socket.bind(SERVER_ADDRESS)

master_server_socket = socket.socket()
master_server_socket.settimeout(30)
master_server_socket.settimeout(15)

def connect_to_master():
logger.info('CONNECTING TO MASTER')
Expand All @@ -134,7 +134,7 @@ def connect_to_master():
pass
while True:
master_server_socket = socket.socket()
master_server_socket.settimeout(30)
master_server_socket.settimeout(15)
# Establish socket connection to the server
try:
master_server_socket.connect((str(masterServer_address),
Expand Down Expand Up @@ -431,6 +431,12 @@ def job_done(dispatcher,event):

else:
logger.info('accepted result')
recieved_start_end = tuple(event.start_end)
CURRENT_JOB = JOBS_TO_PROCESS.get(recieved_start_end,None)
if event.expected_hash != JOB[1]\
or CURRENT_JOB == None:
logger.warning('STOP JOB ON WRONG JOB')
return
HASH_COUNTER += event.result[1]
send_results(event.result)
JOBS_TO_PROCESS = {}
Expand Down

0 comments on commit 709fe7e

Please sign in to comment.