def ping_received(self, on_sock, sender_nid, version, t):
        if on_sock == OUT and self.channels_out not in sender_nid:
            return
        self.last_seen[sender_nid] = t
        if on_sock == IN and sender_nid not in self.channels_in:
            self.channels_in.add(sender_nid)
            if self.is_relay:
                yield RelaySigNew, IN, sender_nid
            elif sender_nid in self.cl_relayees:
                relay_nid = self.cl_relayees.pop(sender_nid)
                self.cl_avail_relays[relay_nid].remove(sender_nid)
                yield RelayNvm, (IN if relay_nid in self.channels_in else OUT), relay_nid, sender_nid
        inout = (IN if sender_nid in self.channels_in else OUT)
        if self._needs_ping(sender_nid, t):
            yield Ping, inout, sender_nid, self._next_version()
        if sender_nid in self.queues:
            for msg_h in self.queues.pop(sender_nid):
                yield Send, inout, sender_nid, self._next_version(), msg_h
        else:
            if not (version > self.versions.get(sender_nid, -1)):
                # version has been reset--he has restarted, so emulate a node-down-node-back-up event pair:
                self.versions[sender_nid] = version
                assert sender_nid not in self.queues
                if sender_nid in self.cl_avail_relays:
                    self._handle_relay_down(sender_nid)
                yield NodeDown, sender_nid
        self.versions[sender_nid] = version
dataset/ETHPy150Open eallik/spinoff/spinoff/remoting/hublogic.py/HubLogic.ping_received/swapped operands of `not in`