Show More
@@ -73,13 +73,13 b' class webproto(wireproto.abstractserverp' | |||||
73 | val = self.ui.fout.getvalue() |
|
73 | val = self.ui.fout.getvalue() | |
74 | self.ui.ferr, self.ui.fout = self.oldio |
|
74 | self.ui.ferr, self.ui.fout = self.oldio | |
75 | return val |
|
75 | return val | |
76 |
def groupchunks(self, |
|
76 | def groupchunks(self, fh): | |
77 | # Don't allow untrusted settings because disabling compression or |
|
77 | # Don't allow untrusted settings because disabling compression or | |
78 | # setting a very high compression level could lead to flooding |
|
78 | # setting a very high compression level could lead to flooding | |
79 | # the server's network or CPU. |
|
79 | # the server's network or CPU. | |
80 | z = zlib.compressobj(self.ui.configint('server', 'zliblevel', -1)) |
|
80 | z = zlib.compressobj(self.ui.configint('server', 'zliblevel', -1)) | |
81 | while True: |
|
81 | while True: | |
82 |
chunk = |
|
82 | chunk = fh.read(32768) | |
83 | if not chunk: |
|
83 | if not chunk: | |
84 | break |
|
84 | break | |
85 | data = z.compress(chunk) |
|
85 | data = z.compress(chunk) |
@@ -68,8 +68,8 b' class sshserver(wireproto.abstractserver' | |||||
68 | def redirect(self): |
|
68 | def redirect(self): | |
69 | pass |
|
69 | pass | |
70 |
|
70 | |||
71 |
def groupchunks(self, |
|
71 | def groupchunks(self, fh): | |
72 |
return iter(lambda: |
|
72 | return iter(lambda: fh.read(4096), '') | |
73 |
|
73 | |||
74 | def sendresponse(self, v): |
|
74 | def sendresponse(self, v): | |
75 | self.fout.write("%d\n" % len(v)) |
|
75 | self.fout.write("%d\n" % len(v)) |
@@ -78,10 +78,11 b' class abstractserverproto(object):' | |||||
78 | # """ |
|
78 | # """ | |
79 | # raise NotImplementedError() |
|
79 | # raise NotImplementedError() | |
80 |
|
80 | |||
81 |
def groupchunks(self, |
|
81 | def groupchunks(self, fh): | |
82 | """return 4096 chunks from a changegroup object |
|
82 | """Generator of chunks to send to the client. | |
83 |
|
83 | |||
84 |
Some protocols may have compressed the contents. |
|
84 | Some protocols may have compressed the contents. | |
|
85 | """ | |||
85 | raise NotImplementedError() |
|
86 | raise NotImplementedError() | |
86 |
|
87 | |||
87 | class remotebatch(peer.batcher): |
|
88 | class remotebatch(peer.batcher): |
General Comments 0
You need to be logged in to leave comments.
Login now