def send_message(self, rcpt_nid, msg_h, t):
        # is it a new connection, or an existing but not yet active connection?
        if rcpt_nid in self.channels_in:
            yield Send, IN, rcpt_nid, self._next_version(), msg_h
        elif rcpt_nid in self.channels_out:
            if rcpt_nid not in self.queues:
                yield Send, OUT, rcpt_nid, self._next_version(), msg_h
            else:
                self.queues[rcpt_nid].append(msg_h)
        elif rcpt_nid in self.queues:
            self.queues[rcpt_nid].append(msg_h)
        elif rcpt_nid in self.cl_relayees:
            relay_nid = self.cl_relayees[rcpt_nid]
            yield RelaySend, (IN if relay_nid in self.channels_in else OUT), relay_nid, rcpt_nid, msg_h
        else:
            self.last_sent[rcpt_nid] = t
            self.channels_out.add(rcpt_nid)
            self.last_seen[rcpt_nid] = t
            self.queues.setdefault(rcpt_nid, []).append(msg_h)
            yield Connect, nid2addr(rcpt_nid)
            yield Ping, OUT, rcpt_nid, self._next_version()
            if self.is_relay:
                yield RelaySigNew, OUT, rcpt_nid
dataset/ETHPy150Open eallik/spinoff/spinoff/remoting/hublogic.py/HubLogic.send_message/original