~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.py

Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
488
488
                mutter('                  (to %s)', self._request._medium._path)
489
489
            mutter('              %d bytes', len(body))
490
490
            self._request_start_time = time.time()
 
491
            if 'hpssdetail' in debug.debug_flags:
 
492
                mutter('hpss body content: %s', body)
491
493
        self._write_args(args)
492
494
        bytes = self._encode_bulk_data(body)
493
495
        self._request.accept_bytes(bytes)
549
551
            return self._body_buffer.read(count)
550
552
        _body_decoder = LengthPrefixedBodyDecoder()
551
553
 
 
554
        # Read no more than 64k at a time so that we don't risk error 10055 (no
 
555
        # buffer space available) on Windows.
 
556
        max_read = 64 * 1024
552
557
        while not _body_decoder.finished_reading:
553
 
            bytes_wanted = _body_decoder.next_read_size()
 
558
            bytes_wanted = min(_body_decoder.next_read_size(), max_read)
554
559
            bytes = self._request.read_bytes(bytes_wanted)
555
560
            _body_decoder.accept_bytes(bytes)
556
561
        self._request.finished_reading()
633
638
    def read_streamed_body(self):
634
639
        """Read bytes from the body, decoding into a byte stream.
635
640
        """
 
641
        # Read no more than 64k at a time so that we don't risk error 10055 (no
 
642
        # buffer space available) on Windows.
 
643
        max_read = 64 * 1024
636
644
        _body_decoder = ChunkedBodyDecoder()
637
645
        while not _body_decoder.finished_reading:
638
 
            bytes_wanted = _body_decoder.next_read_size()
 
646
            bytes_wanted = min(_body_decoder.next_read_size(), max_read)
639
647
            bytes = self._request.read_bytes(bytes_wanted)
640
648
            _body_decoder.accept_bytes(bytes)
641
649
            for body_bytes in iter(_body_decoder.read_next_chunk, None):