Exemple #1
0
 def __init__(self, host, port, sock=None, temporary=False):
     EventMixin.__init__(self)
     asynchat.async_chat.__init__(self, sock, map=make_map(host, port))
     self.set_terminator(TERMINATOR)
     self.received_data = ""
     self.temporary = temporary
     self.sock = sock
     self.dispatcher = None
     self.time = 0
Exemple #2
0
    def __init__(self, transport_content_type="json"):
        threading.Thread.__init__(self)
        EventMixin.__init__(self)
        self.close_when_ready = False

        self.transport_content_type = transport_content_type

        # munge codec instance from transport_content_type
        self.codecClass = munge.get_codec(transport_content_type)
        self.codec = self.codecClass()
Exemple #3
0
 def __init__(self, data, *args, **kwargs):
     EventMixin.__init__(self)
     self.meta = {}
     self.data = data
     self.args = args
     self.kwargs = kwargs
     self.meta.update(id=str(uuid.uuid4()))
     self.responder = None
     self.response_received = False
     self.response_message = None
     self.responded = False
Exemple #4
0
    def __init__(self, receive=None, send=None, respond=None):
        EventMixin.__init__(self)

        self.connection_receive = receive
        self.connection_respond = respond
        self.connection_send = send
        self.meta = {}
        self.name = ""

        if receive:
            receive.on("receive", self.on_receive)
Exemple #5
0
    def __init__(self, name=None, **kwargs):
        """

        Keyword Arguments:
            - name (str): name for this link, if not provided a unique
                default value will be used
            - receive (Connection): if supplied a "main" wire will be
                established using this connection as a receiver
            - send (Connection): if supplied a "main" wire will be
                established using this connection as a sender
            - respond (Connection): if supplied a "main" wire will be
                established using this connection as a responder
        """

        EventMixin.__init__(self)
        self.name = name or get_link_name()
        self.main = None

        if "receive" in kwargs or "send" in kwargs or "respond" in kwargs:
            self.wire("main",
                      receive=kwargs.get("receive"),
                      send=kwargs.get("send"),
                      respond=kwargs.get("respond"))