#NEWLINE# def __init__( self , connection_creator , progress_updates = None , config = None , ireactortime = None , timeout = None , kill_on_stderr = True , stdout = None , stderr = None ) : #NEWLINE# #INDENT# "\n        This will read the output from a Tor process and attempt a\n        connection to its control port when it sees any 'Bootstrapped'\n        message on stdout. You probably don't need to use this\n        directly except as the return value from the\n        :func:`txtorcon.launch_tor` method. tor_protocol contains a\n        valid :class:`txtorcon.TorControlProtocol` instance by that\n        point.\n\n        connection_creator is a callable that should return a Deferred\n        that callbacks with a :class:`txtorcon.TorControlProtocol`;\n        see :func:`txtorcon.launch_tor` for the default one which is a\n        functools.partial that will call\n        ``connect(TorProtocolFactory())`` on an appropriate\n        :api:`twisted.internet.endpoints.TCP4ClientEndpoint`\n\n        :param connection_creator: A no-parameter callable which\n            returns a Deferred which promises a\n            :api:`twisted.internet.interfaces.IStreamClientEndpoint\n            <IStreamClientEndpoint>`. If this is None, we do NOT\n            attempt to connect to the underlying Tor process.\n\n        :param progress_updates: A callback which received progress\n            updates with three args: percent, tag, summary\n\n        :param config: a TorConfig object to connect to the\n            TorControlProtocl from the launched tor (should it succeed)\n\n        :param ireactortime:\n            An object implementing IReactorTime (i.e. a reactor) which\n            needs to be supplied if you pass a timeout.\n\n        :param timeout:\n            An int representing the timeout in seconds. If we are\n            unable to reach 100% by this time we will consider the\n            setting up of Tor to have failed. Must supply ireactortime\n            if you supply this.\n\n        :param kill_on_stderr:\n            When True, kill subprocess if we receive anything on stderr\n\n        :param stdout:\n            Anything subprocess writes to stdout is sent to .write() on this\n\n        :param stderr:\n            Anything subprocess writes to stderr is sent to .write() on this\n\n        :ivar tor_protocol: The TorControlProtocol instance connected\n            to the Tor this :api:`twisted.internet.protocol.ProcessProtocol\n            <ProcessProtocol>`` is speaking to. Will be valid\n            when the `connected_cb` callback runs.\n\n        :ivar connected_cb: Triggered when the Tor process we\n            represent is fully bootstrapped\n\n        " #NEWLINE# self . config = config #NEWLINE# self . tor_protocol = None #NEWLINE# self . progress_updates = progress_updates #NEWLINE# if connection_creator : #NEWLINE# #INDENT# self . connection_creator = connection_creator #NEWLINE# self . connected_cb = defer . Deferred ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . connection_creator = None #NEWLINE# self . connected_cb = None #NEWLINE# #UNINDENT# self . attempted_connect = False #NEWLINE# self . to_delete = [ ] #NEWLINE# self . kill_on_stderr = kill_on_stderr #NEWLINE# self . stderr = stderr #NEWLINE# self . stdout = stdout #NEWLINE# self . _setup_complete = False #NEWLINE# self . _did_timeout = False #NEWLINE# self . _timeout_delayed_call = None #NEWLINE# if timeout : #NEWLINE# #INDENT# if ( not ireactortime ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Must supply an IReactorTime object when supplying a timeout' ) #NEWLINE# #UNINDENT# ireactortime = IReactorTime ( ireactortime ) #NEWLINE# self . _timeout_delayed_call = ireactortime . callLater ( stderr , self . timeout_expired )