Commit ce7cc527 authored by Alexander Schrode's avatar Alexander Schrode Committed by oroulet

Always close secure channel

parent 85ff8559
......@@ -209,7 +209,9 @@ class Client:
try:
await self.send_hello()
await self.open_secure_channel()
try:
endpoints = await self.get_endpoints()
finally:
await self.close_secure_channel()
finally:
self.disconnect_socket()
......@@ -223,7 +225,9 @@ class Client:
try:
await self.send_hello()
await self.open_secure_channel() # spec says it should not be necessary to open channel
try:
servers = await self.find_servers()
finally:
await self.close_secure_channel()
finally:
self.disconnect_socket()
......@@ -237,7 +241,9 @@ class Client:
try:
await self.send_hello()
await self.open_secure_channel()
try:
servers = await self.find_servers_on_network()
finally:
await self.close_secure_channel()
finally:
self.disconnect_socket()
......@@ -253,7 +259,12 @@ class Client:
try:
await self.send_hello()
await self.open_secure_channel()
try:
await self.create_session()
except Exception:
# clean up secure channel
self.close_secure_channel()
raise
except Exception:
# clean up open socket
self.disconnect_socket()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment