RemoteRepository init: always call close on exceptions, fixes #1370

This fixes the cosmetic issue that the cleanup happened in __del__ and caused an AssertionError there.
This commit is contained in:
Thomas Waldmann 2016-07-30 19:42:25 +02:00
parent 1ccadd4ab8
commit 5a83f74418
1 changed files with 6 additions and 6 deletions

View File

@ -170,12 +170,12 @@ class RemoteRepository:
self.x_fds = [self.stdin_fd, self.stdout_fd, self.stderr_fd]
try:
version = self.call('negotiate', RPC_PROTOCOL_VERSION)
except ConnectionClosed:
raise ConnectionClosedWithHint('Is borg working on the server?') from None
if version != RPC_PROTOCOL_VERSION:
raise Exception('Server insisted on using unsupported protocol version %d' % version)
try:
try:
version = self.call('negotiate', RPC_PROTOCOL_VERSION)
except ConnectionClosed:
raise ConnectionClosedWithHint('Is borg working on the server?') from None
if version != RPC_PROTOCOL_VERSION:
raise Exception('Server insisted on using unsupported protocol version %d' % version)
# Because of protocol versions, only send append_only if necessary
if append_only:
try: