1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-03-13 07:33:47 +00:00

Added protocol negotiation support

This commit is contained in:
Jonas Borgström 2011-09-12 21:51:23 +02:00
parent 217da798ab
commit 9e5b13df44

View file

@ -61,6 +61,9 @@ class StoreServer(object):
if es: if es:
return return
def negotiate(self, versions):
return 1
def open(self, path, create=False): def open(self, path, create=False):
if path.startswith('/~'): if path.startswith('/~'):
path = path[1:] path = path[1:]
@ -110,6 +113,10 @@ class RemoteStore(object):
self.msgid = 0 self.msgid = 0
self.recursion = 0 self.recursion = 0
self.odata = [] self.odata = []
# Negotiate protocol version
version = self.cmd('negotiate', (1,))
if version != 1:
raise Exception('Server insisted on using unsupported protocol version %d' % version)
self.id = self.cmd('open', (location.path, create)) self.id = self.cmd('open', (location.path, create))
def wait(self, write=True): def wait(self, write=True):