mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
UPnP: catch InternetException when attempting portforward
we might fail to get the internal IP for some reason, which shouldn't crash the server.
This commit is contained in:
parent
81d5598e96
commit
f26f063164
@ -25,6 +25,7 @@ namespace pocketmine\network\upnp;
|
||||
|
||||
use pocketmine\network\NetworkInterface;
|
||||
use pocketmine\utils\Internet;
|
||||
use pocketmine\utils\InternetException;
|
||||
|
||||
final class UPnPNetworkInterface implements NetworkInterface{
|
||||
|
||||
@ -55,7 +56,7 @@ final class UPnPNetworkInterface implements NetworkInterface{
|
||||
$this->serviceURL = UPnP::getServiceUrl();
|
||||
UPnP::portForward($this->serviceURL, Internet::getInternalIP(), $this->port, $this->port);
|
||||
$this->logger->info("Forwarded $this->ip:$this->port to external port $this->port");
|
||||
}catch(UPnPException $e){
|
||||
}catch(UPnPException | InternetException $e){
|
||||
$this->logger->error("UPnP portforward failed: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user