~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.py

(jelmer) Deprecate Repository.iter_reverse_revision_history(). (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1081
1081
        self._real_write_func = write_func
1082
1082
 
1083
1083
    def _write_func(self, bytes):
 
1084
        # TODO: It is probably more appropriate to use sum(map(len, _buf))
 
1085
        #       for total number of bytes to write, rather than buffer based on
 
1086
        #       the number of write() calls
1084
1087
        # TODO: Another possibility would be to turn this into an async model.
1085
1088
        #       Where we let another thread know that we have some bytes if
1086
1089
        #       they want it, but we don't actually block for it
1289
1292
        _ProtocolThreeEncoder.__init__(self, medium_request.accept_bytes)
1290
1293
        self._medium_request = medium_request
1291
1294
        self._headers = {}
1292
 
        self.body_stream_started = None
1293
1295
 
1294
1296
    def set_headers(self, headers):
1295
1297
        self._headers = headers.copy()
1355
1357
            if path is not None:
1356
1358
                mutter('                  (to %s)', path)
1357
1359
            self._request_start_time = osutils.timer_func()
1358
 
        self.body_stream_started = False
1359
1360
        self._write_protocol_version()
1360
1361
        self._write_headers(self._headers)
1361
1362
        self._write_structure(args)
1363
1364
        #       have finished sending the stream.  We would notice at the end
1364
1365
        #       anyway, but if the medium can deliver it early then it's good
1365
1366
        #       to short-circuit the whole request...
1366
 
        # Provoke any ConnectionReset failures before we start the body stream.
1367
 
        self.flush()
1368
 
        self.body_stream_started = True
1369
1367
        for exc_info, part in _iter_with_errors(stream):
1370
1368
            if exc_info is not None:
1371
1369
                # Iterating the stream failed.  Cleanly abort the request.