/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: Martin Pool
  • Date: 2008-02-06 00:41:04 UTC
  • mfrom: (3215 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3219.
  • Revision ID: mbp@sourcefrog.net-20080206004104-mxtn32habuhjq6b8
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
471
471
    def call(self, *args):
472
472
        if 'hpss' in debug.debug_flags:
473
473
            mutter('hpss call:   %s', repr(args)[1:-1])
 
474
            if getattr(self._request._medium, 'base', None) is not None:
 
475
                mutter('             (to %s)', self._request._medium.base)
474
476
            self._request_start_time = time.time()
475
477
        self._write_args(args)
476
478
        self._request.finished_writing()
482
484
        """
483
485
        if 'hpss' in debug.debug_flags:
484
486
            mutter('hpss call w/body: %s (%r...)', repr(args)[1:-1], body[:20])
 
487
            if getattr(self._request._medium, '_path', None) is not None:
 
488
                mutter('                  (to %s)', self._request._medium._path)
485
489
            mutter('              %d bytes', len(body))
486
490
            self._request_start_time = time.time()
487
491
        self._write_args(args)
497
501
        """
498
502
        if 'hpss' in debug.debug_flags:
499
503
            mutter('hpss call w/readv: %s', repr(args)[1:-1])
 
504
            if getattr(self._request._medium, '_path', None) is not None:
 
505
                mutter('                  (to %s)', self._request._medium._path)
500
506
            self._request_start_time = time.time()
501
507
        self._write_args(args)
502
508
        readv_bytes = self._serialise_offsets(body)
543
549
            return self._body_buffer.read(count)
544
550
        _body_decoder = LengthPrefixedBodyDecoder()
545
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
546
555
        while not _body_decoder.finished_reading:
547
 
            bytes_wanted = _body_decoder.next_read_size()
 
556
            bytes_wanted = min(_body_decoder.next_read_size(), max_read)
548
557
            bytes = self._request.read_bytes(bytes_wanted)
549
558
            _body_decoder.accept_bytes(bytes)
550
559
        self._request.finished_reading()
627
636
    def read_streamed_body(self):
628
637
        """Read bytes from the body, decoding into a byte stream.
629
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
630
642
        _body_decoder = ChunkedBodyDecoder()
631
643
        while not _body_decoder.finished_reading:
632
 
            bytes_wanted = _body_decoder.next_read_size()
 
644
            bytes_wanted = min(_body_decoder.next_read_size(), max_read)
633
645
            bytes = self._request.read_bytes(bytes_wanted)
634
646
            _body_decoder.accept_bytes(bytes)
635
647
            for body_bytes in iter(_body_decoder.read_next_chunk, None):