Răsfoiți Sursa

Merge pull request #459 from ThomasWaldmann/increase-rpc-api-version

increase rpc protocol version to 2, fixes #458
TW 9 ani în urmă
părinte
comite
2e5baa6ec2
1 a modificat fișierele cu 5 adăugiri și 3 ștergeri
  1. 5 3
      borg/remote.py

+ 5 - 3
borg/remote.py

@@ -15,6 +15,8 @@ from .repository import Repository
 
 import msgpack
 
+RPC_PROTOCOL_VERSION = 2
+
 BUFSIZE = 10 * 1024 * 1024
 
 
@@ -96,7 +98,7 @@ class RepositoryServer:  # pragma: no cover
                 return
 
     def negotiate(self, versions):
-        return 1
+        return RPC_PROTOCOL_VERSION
 
     def open(self, path, create=False, lock_wait=None, lock=True):
         path = os.fsdecode(path)
@@ -150,10 +152,10 @@ class RemoteRepository:
         self.x_fds = [self.stdin_fd, self.stdout_fd]
 
         try:
-            version = self.call('negotiate', 1)
+            version = self.call('negotiate', RPC_PROTOCOL_VERSION)
         except ConnectionClosed:
             raise ConnectionClosedWithHint('Is borg working on the server?')
-        if version != 1:
+        if version != RPC_PROTOCOL_VERSION:
             raise Exception('Server insisted on using unsupported protocol version %d' % version)
         self.id = self.call('open', location.path, create, lock_wait, lock)