Skip to content
Snippets Groups Projects
Commit c0eebb51 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Trying to find buffering deadlock

parent 884ec0fd
No related branches found
No related tags found
No related merge requests found
...@@ -113,15 +113,15 @@ class Server: ...@@ -113,15 +113,15 @@ class Server:
self.config.primary.mount.path, self.config.primary.mount.path,
self.path) self.path)
cwd = os.path.join(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') stdout = tar_socket.makefile('wb')
try: try:
def readlines_nul(f): def readlines_nul(s):
buf = b'' buf = b''
while True: while True:
pos = buf.find(b'\x00') pos = buf.find(b'\x00')
if pos == -1: if pos == -1:
tmp = f.read(4096) tmp = s.recv(4096)
print('Got:', len(tmp), file=sys.stderr) print('Got:', len(tmp), file=sys.stderr)
if len(tmp) == 0: if len(tmp) == 0:
if len(buf) == 0: if len(buf) == 0:
...@@ -135,7 +135,7 @@ class Server: ...@@ -135,7 +135,7 @@ class Server:
pass pass
pass pass
writer = tar_stream.TarWriter(stdout) writer = tar_stream.TarWriter(stdout)
for path in readlines_nul(stdin): for path in readlines_nul(tar_socket):
arcname = path.decode('utf8', errors='surrogateescape') arcname = path.decode('utf8', errors='surrogateescape')
try: try:
full_path = os.path.join(cwd, arcname) full_path = os.path.join(cwd, arcname)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment