def _upnp_request(self): """Actually start the program to do the UPNP forwarding""" try: #figure out our local IP address localIP = Twisted.get_lan_ip() #start the external UPNP forwarding program output = self._start_upnp_exe(("-m", localIP, "-a", localIP, str(self.port), str(self.port), self.trafficType)) #handle results output.addCallback(self._upnp_response) output.addErrback(self.upnp_failed) except Exception, error: log_ex(error, "Failed to send UPNP request") self.upnp_failed("Never even sent the request :(")
def _upnp_request(self): """Actually start the program to do the UPNP forwarding""" try: #figure out our local IP address localIP = Twisted.get_lan_ip() #start the external UPNP forwarding program output = self._start_upnp_exe( ("-m", localIP, "-a", localIP, str(self.port), str(self.port), self.trafficType)) #handle results output.addCallback(self._upnp_response) output.addErrback(self.upnp_failed) except Exception, error: log_ex(error, "Failed to send UPNP request") self.upnp_failed("Never even sent the request :(")
def _remove_upnp(self): """Actually call the outside program to remove the UPNP binding. Returns a deferred that will be triggered when the port binding has finished (either successfully or unsuccessfully)""" #failures just get printed out, because we cant really do anything about them def handle_failure(failure): log_msg("Failed to remove UPNP mapping on shutdown: %s" % (failure), 1) try: #figure out our local IP address localIP = Twisted.get_lan_ip() #launch the program output = self._start_upnp_exe(("-m", localIP, "-d", str(self.port), self.trafficType)) #handle results output.addCallback(self._upnp_removed) output.addErrback(handle_failure) return output except Exception, error: log_ex(error, "Failed send request to remove UPNP") handle_failure("Never even sent the request :(")
def _remove_upnp(self): """Actually call the outside program to remove the UPNP binding. Returns a deferred that will be triggered when the port binding has finished (either successfully or unsuccessfully)""" #failures just get printed out, because we cant really do anything about them def handle_failure(failure): log_msg( "Failed to remove UPNP mapping on shutdown: %s" % (failure), 1) try: #figure out our local IP address localIP = Twisted.get_lan_ip() #launch the program output = self._start_upnp_exe( ("-m", localIP, "-d", str(self.port), self.trafficType)) #handle results output.addCallback(self._upnp_removed) output.addErrback(handle_failure) return output except Exception, error: log_ex(error, "Failed send request to remove UPNP") handle_failure("Never even sent the request :(")