Skip to content

Commit

Permalink
don't start miners if no servers are defined
Browse files Browse the repository at this point in the history
  • Loading branch information
m0mchil committed Nov 16, 2012
1 parent fa165ee commit 4a7cec2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
6 changes: 1 addition & 5 deletions Switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ def updatable_miner(self):

def loop(self):
self.should_stop = False
if not self.servers:
print '\nAt least one server is required'
return
else:
self.set_server_index(0)
self.set_server_index(0)

while True:
if self.should_stop: return
Expand Down
13 changes: 7 additions & 6 deletions poclbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ def socketwrap(family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0):
for miner in BFLMiner.initialize(options):
switch.add_miner(miner)

for miner in switch.miners:
miner.start()

if switch.miners:
switch.loop()
else:
if not switch.servers:
print '\nAt least one server is required\n'
elif not switch.miners:
print '\nNothing to mine on, exiting\n'
else:
for miner in switch.miners:
miner.start()
switch.loop()
except KeyboardInterrupt:
print '\nbye'
finally:
Expand Down

0 comments on commit 4a7cec2

Please sign in to comment.