Show More
@@ -1198,13 +1198,21 b' def decodepayloadchunks(ui, fh):' | |||
|
1198 | 1198 | |
|
1199 | 1199 | headersize = struct.calcsize(_fpayloadsize) |
|
1200 | 1200 | readexactly = changegroup.readexactly |
|
1201 | read = fh.read | |
|
1201 | 1202 | |
|
1202 | 1203 | chunksize = _unpack(_fpayloadsize, readexactly(fh, headersize))[0] |
|
1203 | 1204 | indebug(ui, 'payload chunk size: %i' % chunksize) |
|
1204 | 1205 | |
|
1206 | # changegroup.readexactly() is inlined below for performance. | |
|
1205 | 1207 | while chunksize: |
|
1206 | 1208 | if chunksize >= 0: |
|
1207 |
|
|
|
1209 | s = read(chunksize) | |
|
1210 | if len(s) < chunksize: | |
|
1211 | raise error.Abort(_('stream ended unexpectedly ' | |
|
1212 | ' (got %d bytes, expected %d)') % | |
|
1213 | (len(s), chunksize)) | |
|
1214 | ||
|
1215 | yield s | |
|
1208 | 1216 | elif chunksize == flaginterrupt: |
|
1209 | 1217 | # Interrupt "signal" detected. The regular stream is interrupted |
|
1210 | 1218 | # and a bundle2 part follows. Consume it. |
@@ -1213,7 +1221,13 b' def decodepayloadchunks(ui, fh):' | |||
|
1213 | 1221 | raise error.BundleValueError( |
|
1214 | 1222 | 'negative payload chunk size: %s' % chunksize) |
|
1215 | 1223 | |
|
1216 | chunksize = _unpack(_fpayloadsize, readexactly(fh, headersize))[0] | |
|
1224 | s = read(headersize) | |
|
1225 | if len(s) < headersize: | |
|
1226 | raise error.Abort(_('stream ended unexpectedly ' | |
|
1227 | ' (got %d bytes, expected %d)') % | |
|
1228 | (len(s), chunksize)) | |
|
1229 | ||
|
1230 | chunksize = _unpack(_fpayloadsize, s)[0] | |
|
1217 | 1231 | |
|
1218 | 1232 | # indebug() inlined for performance. |
|
1219 | 1233 | if dolog: |
General Comments 0
You need to be logged in to leave comments.
Login now