Mercurial > public > mercurial-scm > hg
comparison mercurial/wireprotoframing.py @ 40328:2c55716f8a1c
wireprotov2: add response type that serializes to indefinite length bytestring
This will be needed in a future patch.
Differential Revision: https://phab.mercurial-scm.org/D5133
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 16 Oct 2018 21:35:33 +0200 |
parents | b5bf3dd6ec5b |
children | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
40327:55836a34f41b | 40328:2c55716f8a1c |
---|---|
1144 # A pre-encoded object is sent directly to the emitter. | 1144 # A pre-encoded object is sent directly to the emitter. |
1145 if isinstance(o, wireprototypes.encodedresponse): | 1145 if isinstance(o, wireprototypes.encodedresponse): |
1146 for frame in emitter.send(o.data): | 1146 for frame in emitter.send(o.data): |
1147 yield frame | 1147 yield frame |
1148 | 1148 |
1149 elif isinstance( | |
1150 o, wireprototypes.indefinitebytestringresponse): | |
1151 for chunk in cborutil.streamencodebytestringfromiter( | |
1152 o.chunks): | |
1153 | |
1154 for frame in emitter.send(chunk): | |
1155 yield frame | |
1156 | |
1149 # A regular object is CBOR encoded. | 1157 # A regular object is CBOR encoded. |
1150 else: | 1158 else: |
1151 for chunk in cborutil.streamencode(o): | 1159 for chunk in cborutil.streamencode(o): |
1152 for frame in emitter.send(chunk): | 1160 for frame in emitter.send(chunk): |
1153 yield frame | 1161 yield frame |