protocol: fail gracefully on cancellation
This commit is contained in:
parent
ea88f425f5
commit
1022e54d6a
@ -81,7 +81,7 @@ class Client(object):
|
||||
except self.call_exception as e:
|
||||
code, msg = e.args
|
||||
log.warning('%s error #%s: %s', self.device_name, code, msg)
|
||||
raise IOError(msg)
|
||||
raise IOError(msg) # close current connection, keep server open
|
||||
|
||||
verifying_key = formats.decompress_pubkey(pubkey=result.public_key,
|
||||
curve_name=self.curve)
|
||||
|
@ -139,7 +139,10 @@ class Handler(object):
|
||||
|
||||
log.debug('signing %d-byte blob', len(blob))
|
||||
label = key['name'].decode('ascii') # label should be a string
|
||||
signature = self.signer(label=label, blob=blob)
|
||||
try:
|
||||
signature = self.signer(label=label, blob=blob)
|
||||
except IOError:
|
||||
return _fail()
|
||||
log.debug('signature: %s', binascii.hexlify(signature))
|
||||
|
||||
try:
|
||||
|
@ -55,8 +55,6 @@ def handle_connection(conn, handler):
|
||||
msg = util.read_frame(conn)
|
||||
reply = handler.handle(msg=msg)
|
||||
util.send(conn, reply)
|
||||
except IOError as e:
|
||||
log.error('I/O error: %s', e)
|
||||
except EOFError:
|
||||
log.debug('goodbye agent')
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
|
Loading…
Reference in New Issue
Block a user