[#3112|Console] Fix handling hex for setting peer_tos in config

The token parser was converting hex value to int which is not what
should be passed onto libtorrent peer_tos setting.
This commit is contained in:
Calum Lind 2017-10-29 22:11:05 +00:00
parent 0ba87b424c
commit 507c5df984
1 changed files with 5 additions and 1 deletions

View File

@ -39,7 +39,11 @@ def atom(src, token):
if token[1] == '-':
return int(token[-1], 0)
else:
return int(token[1], 0)
if token[1].startswith('0x'):
# Hex number so return unconverted as string.
return token[1].decode('string-escape')
else:
return int(token[1], 0)
except ValueError:
try:
return float(token[-1])