Skip to content

Commit

Permalink
Merge pull request #1142 from revoxhere/getpool-timeout
Browse files Browse the repository at this point in the history
/getPool timeout for AVR miner
  • Loading branch information
revoxhere authored Dec 3, 2021
2 parents 04d389f + 7313e16 commit 450f835
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions AVR_Miner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Duino-Coin Official AVR Miner 2.74 © MIT licensed
Duino-Coin Official AVR Miner 2.75 © MIT licensed
https://duinocoin.com
https://github.com/revoxhere/duino-coin
Duino-Coin Team & Community 2019-2021
Expand Down Expand Up @@ -93,9 +93,9 @@ def port_num(com):


class Settings:
VER = '2.74'
SOC_TIMEOUT = 45
REPORT_TIME = 60
VER = '2.75'
SOC_TIMEOUT = 15
REPORT_TIME = 120
AVR_TIMEOUT = 4 # diff 6 * 100 / 196 h/s = 3.06
BAUDRATE = 115200
DATA_DIR = "Duino-Coin AVR Miner " + str(VER)
Expand Down Expand Up @@ -134,7 +134,8 @@ def fetch_pool():
"warning")
try:
response = requests.get(
"https://server.duinocoin.com/getPool").json()
"https://server.duinocoin.com/getPool",
timeout=5).json()
if response["success"] == True:
NODE_ADDRESS = response["ip"]
NODE_PORT = response["port"]
Expand Down Expand Up @@ -162,7 +163,7 @@ def load(donation_level):
f"{Settings.DATA_DIR}/Donate.exe").is_file():
url = ('https://server.duinocoin.com/'
+ 'donations/DonateExecutableWindows.exe')
r = requests.get(url)
r = requests.get(url, timeout=10)
with open(f"{Settings.DATA_DIR}/Donate.exe",
'wb') as f:
f.write(r.content)
Expand All @@ -178,7 +179,7 @@ def load(donation_level):
+ 'donations/DonateExecutableLinux')
if not Path(
f"{Settings.DATA_DIR}/Donate").is_file():
r = requests.get(url)
r = requests.get(url, timeout=10)
with open(f"{Settings.DATA_DIR}/Donate",
"wb") as f:
f.write(r.content)
Expand Down Expand Up @@ -235,7 +236,7 @@ def start(donation_level):
+ 'revoxhere/'
+ 'duino-coin/master/Resources/'
+ 'AVR_Miner_langs.json')
r = requests.get(url)
r = requests.get(url, timeout=5)
with open(Settings.DATA_DIR + '/Translations.json', 'wb') as f:
f.write(r.content)

Expand Down Expand Up @@ -675,7 +676,7 @@ def mine_avr(com, threadid, fastest_pool):
try:
ser.close()
pretty_print('sys' + port_num(com),
f"Closed COM port {com}", 'success')
f"Closed COM port {com}", 'success')
sleep(2)
except:
pass
Expand Down Expand Up @@ -956,8 +957,8 @@ def calculate_uptime(start_time):
threadid = 0
for port in avrport:
Thread(target=mine_avr,
args=(port, threadid,
fastest_pool)).start()
args=(port, threadid,
fastest_pool)).start()
threadid += 1
except Exception as e:
debug_output(f'Error launching AVR thread(s): {e}')
Expand Down

0 comments on commit 450f835

Please sign in to comment.