~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-01-14 01:40:02 UTC
  • mfrom: (3177.1.1 ianc-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080114014002-pz5tya37urp1n3fk
Fix typos of Firefox and OpenOffice.org in docs (Matt Nordhoff)

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)
476
474
            self._request_start_time = time.time()
477
475
        self._write_args(args)
478
476
        self._request.finished_writing()
484
482
        """
485
483
        if 'hpss' in debug.debug_flags:
486
484
            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)
489
485
            mutter('              %d bytes', len(body))
490
486
            self._request_start_time = time.time()
491
 
            if 'hpssdetail' in debug.debug_flags:
492
 
                mutter('hpss body content: %s', body)
493
487
        self._write_args(args)
494
488
        bytes = self._encode_bulk_data(body)
495
489
        self._request.accept_bytes(bytes)
503
497
        """
504
498
        if 'hpss' in debug.debug_flags:
505
499
            mutter('hpss call w/readv: %s', repr(args)[1:-1])
506
 
            if getattr(self._request._medium, '_path', None) is not None:
507
 
                mutter('                  (to %s)', self._request._medium._path)
508
500
            self._request_start_time = time.time()
509
501
        self._write_args(args)
510
502
        readv_bytes = self._serialise_offsets(body)
551
543
            return self._body_buffer.read(count)
552
544
        _body_decoder = LengthPrefixedBodyDecoder()
553
545
 
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
557
546
        while not _body_decoder.finished_reading:
558
 
            bytes_wanted = min(_body_decoder.next_read_size(), max_read)
 
547
            bytes_wanted = _body_decoder.next_read_size()
559
548
            bytes = self._request.read_bytes(bytes_wanted)
560
549
            _body_decoder.accept_bytes(bytes)
561
550
        self._request.finished_reading()
638
627
    def read_streamed_body(self):
639
628
        """Read bytes from the body, decoding into a byte stream.
640
629
        """
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
644
630
        _body_decoder = ChunkedBodyDecoder()
645
631
        while not _body_decoder.finished_reading:
646
 
            bytes_wanted = min(_body_decoder.next_read_size(), max_read)
 
632
            bytes_wanted = _body_decoder.next_read_size()
647
633
            bytes = self._request.read_bytes(bytes_wanted)
648
634
            _body_decoder.accept_bytes(bytes)
649
635
            for body_bytes in iter(_body_decoder.read_next_chunk, None):