=== modified file 'bzrlib/pack.py'
--- bzrlib/pack.py 2007-11-10 15:09:09 +0000
+++ bzrlib/pack.py 2008-03-05 09:28:02 +0000
@@ -161,10 +161,14 @@
class ReadVFile(object):
"""Adapt a readv result iterator to a file like protocol."""
- def __init__(self, readv_result):
+ def __init__(self, readv_result, header=None): self.readv_result = readv_result
# the most recent readv result block
- self._string = None
+ if header is not None:
+ self._string = StringIO(header)
+ self._string_length = len(header)
+ else:
+ self._string = None
def _next(self):
if (self._string is None or
@@ -197,10 +201,12 @@
:param requested_records: The record offset, length tuples as returned
by add_bytes_record for the desired records.
"""
- readv_blocks = [(0, len(FORMAT_ONE)+1)]
- readv_blocks.extend(requested_records)
+ # readv_blocks = [(0, len(FORMAT_ONE)+1)]
+ # readv_blocks.extend(requested_records)
+ header = list(transport.readv(filename, [(0, len(FORMAT_ONE)+1)]))[0][1]
result = ContainerReader(ReadVFile(
- transport.readv(filename, readv_blocks)))
+ transport.readv(filename, requested_records),
+ header=header))
return result
At the moment we always tack on the header read to the rest of the read, which is nice because we get one round-trip request to the server.
A *better* fix might understand the squid bug better, and then normally tack on the header, but when it would trigger the squid bug issue it separately.
This is a possible patch:
=== modified file 'bzrlib/pack.py'
--- bzrlib/pack.py 2007-11-10 15:09:09 +0000
+++ bzrlib/pack.py 2008-03-05 09:28:02 +0000
@@ -161,10 +161,14 @@
class ReadVFile(object):
"""Adapt a readv result iterator to a file like protocol."""
- def __init__(self, readv_result):
self. readv_result = readv_result
+ def __init__(self, readv_result, header=None):
# the most recent readv result block
- self._string = None
+ if header is not None:
+ self._string = StringIO(header)
+ self._string_length = len(header)
+ else:
+ self._string = None
def _next(self): extend( requested_ records) extend( requested_ records) readv(filename, [(0, len(FORMAT_ ONE)+1) ]))[0][ 1] (ReadVFile( readv(filename, readv_blocks))) readv(filename, requested_records),
if (self._string is None or
@@ -197,10 +201,12 @@
:param requested_records: The record offset, length tuples as returned
by add_bytes_record for the desired records.
"""
- readv_blocks = [(0, len(FORMAT_ONE)+1)]
- readv_blocks.
+ # readv_blocks = [(0, len(FORMAT_ONE)+1)]
+ # readv_blocks.
+ header = list(transport.
result = ContainerReader
- transport.
+ transport.
+ header=header))
return result
At the moment we always tack on the header read to the rest of the read, which is nice because we get one round-trip request to the server.
A *better* fix might understand the squid bug better, and then normally tack on the header, but when it would trigger the squid bug issue it separately.