network: minor fix in switch_to_interface

This commit is contained in:
SomberNight 2018-09-10 02:30:27 +02:00
parent 6b2509b106
commit 526319630e
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9
2 changed files with 3 additions and 2 deletions

View file

@ -212,7 +212,7 @@ class Interface(PrintError):
try: try:
await self.open_session(ssl_context, exit_early=False) await self.open_session(ssl_context, exit_early=False)
except (asyncio.CancelledError, OSError, aiorpcx.socks.SOCKSFailure) as e: except (asyncio.CancelledError, OSError, aiorpcx.socks.SOCKSFailure) as e:
self.print_error('disconnecting due to: {}'.format(e)) self.print_error('disconnecting due to: {} {}'.format(e, type(e)))
self.exception = e self.exception = e
return return
# should never get here (can only exit via exception) # should never get here (can only exit via exception)

View file

@ -569,9 +569,10 @@ class Network(PrintError):
# and to cancel tasks in interface.group. # and to cancel tasks in interface.group.
# However, for headers sub, give preference to this interface # However, for headers sub, give preference to this interface
# over unknown ones, i.e. start it again right away. # over unknown ones, i.e. start it again right away.
old_server = self.interface.server
self.close_interface(self.interface) self.close_interface(self.interface)
if len(self.interfaces) <= self.num_server: if len(self.interfaces) <= self.num_server:
self.start_interface(self.interface.server) self.start_interface(old_server)
self.interface = i self.interface = i
asyncio.get_event_loop().create_task( asyncio.get_event_loop().create_task(