Set the shutdown event via call_soon
Fixes #480 Require aiorpcx 0.5.6, handle ConnectionError appropriately; this ensures the same bug would give a better error message
This commit is contained in:
parent
6928b251f8
commit
52658cfc9c
@ -591,7 +591,7 @@ class Controller(ServerBase):
|
||||
|
||||
def rpc_stop(self):
|
||||
'''Shut down the server cleanly.'''
|
||||
self.shutdown_event.set()
|
||||
self.loop.call_soon(self.shutdown_event.set)
|
||||
return 'stopping'
|
||||
|
||||
def rpc_getinfo(self):
|
||||
|
||||
@ -16,7 +16,7 @@ import time
|
||||
from collections import defaultdict, Counter
|
||||
from functools import partial
|
||||
|
||||
from aiorpcx import ClientSession, RPCError, SOCKSProxy
|
||||
from aiorpcx import ClientSession, RPCError, SOCKSProxy, ConnectionError
|
||||
|
||||
from lib.peer import Peer
|
||||
from lib.util import ConnectionLogger
|
||||
@ -73,7 +73,7 @@ class PeerSession(ClientSession):
|
||||
def is_good(self, request, instance):
|
||||
try:
|
||||
result = request.result()
|
||||
except asyncio.CancelledError:
|
||||
except (asyncio.CancelledError, ConnectionError):
|
||||
return False
|
||||
except asyncio.TimeoutError as e:
|
||||
self.fail(request, str(e))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user