mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
disconnect from servers on exception
This commit is contained in:
parent
3f0d79f07d
commit
14a032a0b1
2 changed files with 12 additions and 8 deletions
|
@ -244,6 +244,8 @@ class BlockHeaderInterface(PrintError):
|
||||||
could_connect, num_headers = await self.conn.request_chunk(self.height, next_height)
|
could_connect, num_headers = await self.conn.request_chunk(self.height, next_height)
|
||||||
self.tip = max(self.height + num_headers, self.tip)
|
self.tip = max(self.height + num_headers, self.tip)
|
||||||
if not could_connect:
|
if not could_connect:
|
||||||
|
if self.height <= self.iface.network.max_checkpoint():
|
||||||
|
raise Exception('server chain conflicts with checkpoints or genesis')
|
||||||
last = await self.step()
|
last = await self.step()
|
||||||
self.tip = max(self.height, self.tip)
|
self.tip = max(self.height, self.tip)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -809,14 +809,16 @@ class Network(PrintError):
|
||||||
asyncio.get_event_loop().create_task(self.new_interface(server))
|
asyncio.get_event_loop().create_task(self.new_interface(server))
|
||||||
remove = []
|
remove = []
|
||||||
for k, i in self.interfaces.items():
|
for k, i in self.interfaces.items():
|
||||||
if i.fut.done():
|
if i.fut.done() and not i.exception:
|
||||||
if i.exception:
|
assert False, "interface future should not finish without exception"
|
||||||
try:
|
if i.exception:
|
||||||
raise i.exception
|
if not i.fut.done():
|
||||||
except BaseException as e:
|
try: i.fut.cancel()
|
||||||
self.print_error(i.server, "errored because", str(e), str(type(e)))
|
except Exception as e: self.print_error('exception while cancelling fut', e)
|
||||||
else:
|
try:
|
||||||
assert False, "interface future should not finish without exception"
|
raise i.exception
|
||||||
|
except BaseException as e:
|
||||||
|
self.print_error(i.server, "errored because", str(e), str(type(e)))
|
||||||
remove.append(k)
|
remove.append(k)
|
||||||
changed = False
|
changed = False
|
||||||
for k in remove:
|
for k in remove:
|
||||||
|
|
Loading…
Add table
Reference in a new issue