diff options
-rwxr-xr-x | tupkg/client/tupkg | 16 | ||||
-rwxr-xr-x | tupkg/server/tupkgs | 9 |
2 files changed, 17 insertions, 8 deletions
diff --git a/tupkg/client/tupkg b/tupkg/client/tupkg index 4c0da4e..14eb1c0 100755 --- a/tupkg/client/tupkg +++ b/tupkg/client/tupkg @@ -121,14 +121,16 @@ def main(argv=None): usage() return 1 - try: - fil = ClientFile(argv[1]) - except IOError, err: - print "Error: " + err.strerror + ": '" + err.filename + "'" - usage() - return 1 + files = [] + for i in argv[1:]: + try: + files.append(ClientFile(i)) + except IOError, err: + print "Error: " + err.strerror + ": '" + err.filename + "'" + usage() + return 1 - cs = ClientSocket([fil], 'localhost', 1034, "bfinch@example.net", "B0b") + cs = ClientSocket(files, 'localhost', 1034, "bfinch@example.net", "B0b") cs.connect() if not cs.auth(): diff --git a/tupkg/server/tupkgs b/tupkg/server/tupkgs index ef010c9..4dd085b 100755 --- a/tupkg/server/tupkgs +++ b/tupkg/server/tupkgs @@ -108,7 +108,14 @@ class ClientSocket(threading.Thread): def readFiles(self): for i in self.files: - i.fd.write(self.reliableRead(i.actual_size)) + count = 0 + while count != i.actual_size: + if count + 1024 > i.actual_size: + i.fd.write(self.reliableRead(i.actual_size - count)) + count += i.actual_size - count + else: + i.fd.write(self.reliableRead(1024)) + count += 1024 i.fd.flush() reply = {'numpkgs': len(self.files)} for i, v in enumerate(self.files): |