/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: Jonathan Lange
  • Date: 2009-12-09 09:20:42 UTC
  • mfrom: (4881 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4907.
  • Revision ID: jml@canonical.com-20091209092042-s2zgqcf8f39yzxpj
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
class SmartServerRequestProtocolOne(SmartProtocolBase):
115
115
    """Server-side encoding and decoding logic for smart version 1."""
116
116
 
117
 
    def __init__(self, backing_transport, write_func, root_client_path='/'):
 
117
    def __init__(self, backing_transport, write_func, root_client_path='/',
 
118
            jail_root=None):
118
119
        self._backing_transport = backing_transport
119
120
        self._root_client_path = root_client_path
 
121
        self._jail_root = jail_root
120
122
        self.unused_data = ''
121
123
        self._finished = False
122
124
        self.in_buffer = ''
144
146
                req_args = _decode_tuple(first_line)
145
147
                self.request = request.SmartServerRequestHandler(
146
148
                    self._backing_transport, commands=request.request_handlers,
147
 
                    root_client_path=self._root_client_path)
148
 
                self.request.dispatch_command(req_args[0], req_args[1:])
 
149
                    root_client_path=self._root_client_path,
 
150
                    jail_root=self._jail_root)
 
151
                self.request.args_received(req_args)
149
152
                if self.request.finished_reading:
150
153
                    # trivial request
151
154
                    self.unused_data = self.in_buffer
858
861
 
859
862
 
860
863
def build_server_protocol_three(backing_transport, write_func,
861
 
                                root_client_path):
 
864
                                root_client_path, jail_root=None):
862
865
    request_handler = request.SmartServerRequestHandler(
863
866
        backing_transport, commands=request.request_handlers,
864
 
        root_client_path=root_client_path)
 
867
        root_client_path=root_client_path, jail_root=jail_root)
865
868
    responder = ProtocolThreeResponder(write_func)
866
869
    message_handler = message.ConventionalRequestHandler(request_handler, responder)
867
870
    return ProtocolThreeDecoder(message_handler)
897
900
            # We do *not* set self.decoding_failed here.  The message handler
898
901
            # has raised an error, but the decoder is still able to parse bytes
899
902
            # and determine when this message ends.
900
 
            log_exception_quietly()
 
903
            if not isinstance(exception.exc_value, errors.UnknownSmartMethod):
 
904
                log_exception_quietly()
901
905
            self.message_handler.protocol_error(exception.exc_value)
902
906
            # The state machine is ready to continue decoding, but the
903
907
            # exception has interrupted the loop that runs the state machine.
1036
1040
            raise errors.SmartMessageHandlerError(sys.exc_info())
1037
1041
 
1038
1042
    def _state_accept_reading_unused(self):
1039
 
        self.unused_data = self._get_in_buffer()
 
1043
        self.unused_data += self._get_in_buffer()
1040
1044
        self._set_in_buffer(None)
1041
1045
 
1042
1046
    def next_read_size(self):
1208
1212
        except (KeyboardInterrupt, SystemExit):
1209
1213
            raise
1210
1214
        except Exception:
 
1215
            mutter('_iter_with_errors caught error')
 
1216
            log_exception_quietly()
1211
1217
            yield sys.exc_info(), None
1212
1218
            return
1213
1219