/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.py

  • Committer: Andrew Bennetts
  • Date: 2008-01-08 05:39:31 UTC
  • mto: This revision was merged to the branch mainline in revision 3195.
  • Revision ID: andrew.bennetts@canonical.com-20080108053931-ezafty4oqtnl8j4z
Fix the other half of bug #115781: don't read more than 64k at a time either.

Show diffs side-by-side

added added

removed removed

Lines of Context:
543
543
            return self._body_buffer.read(count)
544
544
        _body_decoder = LengthPrefixedBodyDecoder()
545
545
 
 
546
        # Read no more than 64k at a time so that we don't risk error 10055 (no
 
547
        # buffer space available) on Windows.
 
548
        max_read = 64 * 1024
546
549
        while not _body_decoder.finished_reading:
547
 
            bytes_wanted = _body_decoder.next_read_size()
 
550
            bytes_wanted = min(_body_decoder.next_read_size(), max_read)
548
551
            bytes = self._request.read_bytes(bytes_wanted)
549
552
            _body_decoder.accept_bytes(bytes)
550
553
        self._request.finished_reading()
627
630
    def read_streamed_body(self):
628
631
        """Read bytes from the body, decoding into a byte stream.
629
632
        """
 
633
        # Read no more than 64k at a time so that we don't risk error 10055 (no
 
634
        # buffer space available) on Windows.
 
635
        max_read = 64 * 1024
630
636
        _body_decoder = ChunkedBodyDecoder()
631
637
        while not _body_decoder.finished_reading:
632
 
            bytes_wanted = _body_decoder.next_read_size()
 
638
            bytes_wanted = min(_body_decoder.next_read_size(), max_read)
633
639
            bytes = self._request.read_bytes(bytes_wanted)
634
640
            _body_decoder.accept_bytes(bytes)
635
641
            for body_bytes in iter(_body_decoder.read_next_chunk, None):