log invalid vs missing token
This commit is contained in:
parent
333d70860b
commit
a8025b02c6
1 changed files with 8 additions and 6 deletions
|
@ -515,18 +515,20 @@ class Node(object):
|
||||||
else:
|
else:
|
||||||
raise TypeError, 'No contact info available'
|
raise TypeError, 'No contact info available'
|
||||||
|
|
||||||
if ((self_store is False) and
|
if not self_store:
|
||||||
('token' not in value or not self.verify_token(value['token'], compact_ip))):
|
if 'token' not in value:
|
||||||
raise ValueError('Invalid or missing token')
|
raise ValueError("Missing token")
|
||||||
|
if not self.verify_token(value['token'], compact_ip):
|
||||||
|
raise ValueError("Invalid token")
|
||||||
|
|
||||||
if 'port' in value:
|
if 'port' in value:
|
||||||
port = int(value['port'])
|
port = int(value['port'])
|
||||||
if 0 <= port <= 65536:
|
if 0 <= port <= 65536:
|
||||||
compact_port = str(struct.pack('>H', port))
|
compact_port = str(struct.pack('>H', port))
|
||||||
else:
|
else:
|
||||||
raise TypeError, 'Invalid port'
|
raise TypeError('Invalid port')
|
||||||
else:
|
else:
|
||||||
raise TypeError, 'No port available'
|
raise TypeError('No port available')
|
||||||
|
|
||||||
if 'lbryid' in value:
|
if 'lbryid' in value:
|
||||||
if len(value['lbryid']) != constants.key_bits / 8:
|
if len(value['lbryid']) != constants.key_bits / 8:
|
||||||
|
@ -535,7 +537,7 @@ class Node(object):
|
||||||
else:
|
else:
|
||||||
compact_address = compact_ip + compact_port + value['lbryid']
|
compact_address = compact_ip + compact_port + value['lbryid']
|
||||||
else:
|
else:
|
||||||
raise TypeError, 'No lbryid given'
|
raise TypeError('No lbryid given')
|
||||||
|
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
originallyPublished = now # - age
|
originallyPublished = now # - age
|
||||||
|
|
Loading…
Reference in a new issue