Skip to content

Commit

Permalink
fixed sharereply result handler raising a string as an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestv committed Aug 18, 2013
1 parent 47f4690 commit 3ca723e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion p2pool/p2p.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,12 @@ def handle_sharereq(self, id, hashes, parents, stops):
('result', pack.EnumType(pack.VarIntType(), {0: 'good', 1: 'too long', 2: 'unk2', 3: 'unk3', 4: 'unk4', 5: 'unk5', 6: 'unk6'})),
('shares', pack.ListType(p2pool_data.share_type)),
])
class ShareReplyError(Exception): pass
def handle_sharereply(self, id, result, shares):
if result == 'good':
res = [p2pool_data.load_share(share, self.node.net, self.addr) for share in shares if share['type'] >= 9]
else:
res = failure.Failure("sharereply result: " + result)
res = failure.Failure(self.ShareReplyError(result))
self.get_shares.got_response(id, res)


Expand Down

0 comments on commit 3ca723e

Please sign in to comment.