def _try_upnp(self):

        log.debug("In _try_upnp")

        def threaded_try_upnp():
            if self.use_upnp is False:
                log.debug("Not using upnp")
                return False
            u = miniupnpc.UPnP()
            num_devices_found = u.discover()
            if 0 > num_devices_found:
                u.selectigd()
                external_ip = u.externalipaddress()
                if external_ip != '0.0.0.0':
                    self.external_ip = external_ip
                if self.peer_port is not None:
                    if u.getspecificportmapping(self.peer_port, 'TCP') is None:
                        u.addportmapping(self.peer_port, 'TCP', u.lanaddr, self.peer_port, 'LBRY peer port', '')
                        self.upnp_redirects.append((self.peer_port, 'TCP'))
                        log.info("Set UPnP redirect for TCP port %d", self.peer_port)
                    else:
                        log.warning("UPnP redirect already set for TCP port %d", self.peer_port)
                if self.dht_node_port is not None:
                    if u.getspecificportmapping(self.dht_node_port, 'UDP') is None:
                        u.addportmapping(self.dht_node_port, 'UDP', u.lanaddr, self.dht_node_port, 'LBRY DHT port', '')
                        self.upnp_redirects.append((self.dht_node_port, 'UDP'))
                        log.info("Set UPnP redirect for UPD port %d", self.dht_node_port)
                    else:
                        log.warning("UPnP redirect already set for UDP port %d", self.dht_node_port)
                return True
            return False

        def upnp_failed(err):
            log.warning("UPnP failed. Reason: %s", err.getErrorMessage())
            return False

        d = threads.deferToThread(threaded_try_upnp)
        d.addErrback(upnp_failed)
        return d
dataset/ETHPy150Open lbryio/lbry/lbrynet/core/Session.py/LBRYSession._try_upnp/swapped operands of `>`