示例#1
0
 def add_stream_listener(self, istreamlistener):
     """
     Adds a new instance of :class:`txtorcon.interface.IStreamListener` which
     will receive updates for all existing and new streams.
     """
     listen = IStreamListener(istreamlistener)
     for stream in self.streams.values():
         stream.listen(listen)
     self.stream_listeners.append(listen)
示例#2
0
    def listen(self, listen):
        """
        Attach an :class:`txtorcon.interface.IStreamListener` to this stream.

        See also :meth:`txtorcon.TorState.add_stream_listener` to
        listen to all streams.

        :param listen: something that knows
        :class:`txtorcon.interface.IStreamListener`
        """

        listener = IStreamListener(listen)
        if listener not in self.listeners:
            self.listeners.append(listener)
示例#3
0
 def add_stream_listener(self, istreamlistener):
     listen = IStreamListener(istreamlistener)
     for stream in self.streams.values():
         stream.listen(listen)
     self.stream_listeners.append(listen)