From c0eebb5199bf3702d8162894670508aef06c7044 Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Thu, 21 Jan 2021 12:33:30 +0100 Subject: [PATCH] Trying to find buffering deadlock --- primary.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/primary.py b/primary.py index 9385272..e4d528f 100644 --- a/primary.py +++ b/primary.py @@ -113,15 +113,15 @@ class Server: self.config.primary.mount.path, self.path) cwd = os.path.join(self.config.primary.mount.path, self.path) - stdin = tar_socket.makefile('rb') + #stdin = tar_socket.makefile('rb') stdout = tar_socket.makefile('wb') try: - def readlines_nul(f): + def readlines_nul(s): buf = b'' while True: pos = buf.find(b'\x00') if pos == -1: - tmp = f.read(4096) + tmp = s.recv(4096) print('Got:', len(tmp), file=sys.stderr) if len(tmp) == 0: if len(buf) == 0: @@ -135,7 +135,7 @@ class Server: pass pass writer = tar_stream.TarWriter(stdout) - for path in readlines_nul(stdin): + for path in readlines_nul(tar_socket): arcname = path.decode('utf8', errors='surrogateescape') try: full_path = os.path.join(cwd, arcname) -- GitLab