Comments
Patch
@@ -68,23 +68,23 @@ class webproto(wireproto.abstractserverp
fp.write(s)
def redirect(self):
self.oldio = self.ui.fout, self.ui.ferr
self.ui.ferr = self.ui.fout = stringio()
def restore(self):
val = self.ui.fout.getvalue()
self.ui.ferr, self.ui.fout = self.oldio
return val
- def groupchunks(self, cg):
+ def groupchunks(self, fh):
# Don't allow untrusted settings because disabling compression or
# setting a very high compression level could lead to flooding
# the server's network or CPU.
z = zlib.compressobj(self.ui.configint('server', 'zliblevel', -1))
while True:
- chunk = cg.read(32768)
+ chunk = fh.read(32768)
if not chunk:
break
data = z.compress(chunk)
# Not all calls to compress() emit data. It is cheaper to inspect
# that here than to send it via the generator.
if data:
yield data
yield z.flush()
@@ -63,18 +63,18 @@ class sshserver(wireproto.abstractserver
count = int(self.fin.readline())
while count:
fpout.write(self.fin.read(count))
count = int(self.fin.readline())
def redirect(self):
pass
- def groupchunks(self, changegroup):
- return iter(lambda: changegroup.read(4096), '')
+ def groupchunks(self, fh):
+ return iter(lambda: fh.read(4096), '')
def sendresponse(self, v):
self.fout.write("%d\n" % len(v))
self.fout.write(v)
self.fout.flush()
def sendstream(self, source):
write = self.fout.write
@@ -73,20 +73,21 @@ class abstractserverproto(object):
#
# left commented here on purpose
#
#def restore(self):
# """reinstall previous stdout and stderr and return intercepted stdout
# """
# raise NotImplementedError()
- def groupchunks(self, cg):
- """return 4096 chunks from a changegroup object
+ def groupchunks(self, fh):
+ """Generator of chunks to send to the client.
- Some protocols may have compressed the contents."""
+ Some protocols may have compressed the contents.
+ """
raise NotImplementedError()
class remotebatch(peer.batcher):
'''batches the queued calls; uses as few roundtrips as possible'''
def __init__(self, remote):
'''remote must support _submitbatch(encbatch) and
_submitone(op, encargs)'''
peer.batcher.__init__(self)