/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: Alexander Belchenko
  • Date: 2008-01-25 18:19:06 UTC
  • mfrom: (3200 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3201.
  • Revision ID: bialix@ukr.net-20080125181906-hnbj8fkesuxz94bc
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
549
549
            return self._body_buffer.read(count)
550
550
        _body_decoder = LengthPrefixedBodyDecoder()
551
551
 
 
552
        # Read no more than 64k at a time so that we don't risk error 10055 (no
 
553
        # buffer space available) on Windows.
 
554
        max_read = 64 * 1024
552
555
        while not _body_decoder.finished_reading:
553
 
            bytes_wanted = _body_decoder.next_read_size()
 
556
            bytes_wanted = min(_body_decoder.next_read_size(), max_read)
554
557
            bytes = self._request.read_bytes(bytes_wanted)
555
558
            _body_decoder.accept_bytes(bytes)
556
559
        self._request.finished_reading()
633
636
    def read_streamed_body(self):
634
637
        """Read bytes from the body, decoding into a byte stream.
635
638
        """
 
639
        # Read no more than 64k at a time so that we don't risk error 10055 (no
 
640
        # buffer space available) on Windows.
 
641
        max_read = 64 * 1024
636
642
        _body_decoder = ChunkedBodyDecoder()
637
643
        while not _body_decoder.finished_reading:
638
 
            bytes_wanted = _body_decoder.next_read_size()
 
644
            bytes_wanted = min(_body_decoder.next_read_size(), max_read)
639
645
            bytes = self._request.read_bytes(bytes_wanted)
640
646
            _body_decoder.accept_bytes(bytes)
641
647
            for body_bytes in iter(_body_decoder.read_next_chunk, None):