Skip to content

Commit

Permalink
Fixes #4 and #6. Failing to recieve on socket will not crash daemon now.
Browse files Browse the repository at this point in the history
  • Loading branch information
icook committed Mar 13, 2014
1 parent 7c0c02c commit ea8c7f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions ppagent/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from string import Template
from os.path import expanduser

version = '0.2.5'
version = '0.2.6'

logger = logging.getLogger("ppagent")
config_home = expanduser("~/.ppagent/")
Expand Down Expand Up @@ -261,7 +261,12 @@ def recieve(self):
if self.conn is None:
return {}

recv = self.conn.readline(4096)
try:
recv = self.conn.readline(4096)
except socket.error:
self.reset_connection()
return {}

if len(recv) > 4000:
raise Exception("Server returned too large of a string")
logger.debug("Recieved response from server {0}".format(recv.strip()))
Expand Down Expand Up @@ -302,7 +307,7 @@ def transmit(self):
continue

retval = self.recieve()
if retval['error'] is None:
if retval.get('error', True) is None:
logger.info("Successfully authenticated {0}".format(username))
miner.authenticated = True
miner.reset_timers()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
requires.append('argparse')

setup(name='ppagent',
version='0.2.5',
version='0.2.6',
description='A statistics collection agent for powerpool mining server',
author='Isaac Cook',
long_description=README,
Expand Down

0 comments on commit ea8c7f9

Please sign in to comment.