mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
added support for multiple files in the client and made the file reading less memory intensive for the server (poorly, mind you)
This commit is contained in:
parent
2423a686d6
commit
a4710414e0
2 changed files with 17 additions and 8 deletions
|
@ -121,14 +121,16 @@ def main(argv=None):
|
||||||
usage()
|
usage()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
files = []
|
||||||
|
for i in argv[1:]:
|
||||||
try:
|
try:
|
||||||
fil = ClientFile(argv[1])
|
files.append(ClientFile(i))
|
||||||
except IOError, err:
|
except IOError, err:
|
||||||
print "Error: " + err.strerror + ": '" + err.filename + "'"
|
print "Error: " + err.strerror + ": '" + err.filename + "'"
|
||||||
usage()
|
usage()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
cs = ClientSocket([fil], 'localhost', 1034, "bfinch@example.net", "B0b")
|
cs = ClientSocket(files, 'localhost', 1034, "bfinch@example.net", "B0b")
|
||||||
cs.connect()
|
cs.connect()
|
||||||
|
|
||||||
if not cs.auth():
|
if not cs.auth():
|
||||||
|
|
|
@ -108,7 +108,14 @@ class ClientSocket(threading.Thread):
|
||||||
|
|
||||||
def readFiles(self):
|
def readFiles(self):
|
||||||
for i in self.files:
|
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()
|
i.fd.flush()
|
||||||
reply = {'numpkgs': len(self.files)}
|
reply = {'numpkgs': len(self.files)}
|
||||||
for i, v in enumerate(self.files):
|
for i, v in enumerate(self.files):
|
||||||
|
|
Loading…
Add table
Reference in a new issue