mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-05-10 15:56:15 +00:00
Fix failure to connect to world on routers that lack Hairpin NAT support when connecting from the same network.
This commit is contained in:
parent
697547da25
commit
568c968c4e
2 changed files with 6 additions and 2 deletions
|
|
@ -4,6 +4,9 @@ bind = 127.0.0.1
|
|||
|
||||
# The public host name or IP address. Used to forward clients from the login
|
||||
# server to the world server. The default value will only allow local connections.
|
||||
# If you encounter issues trying to connect to the world from machines on the same network (or the same machine when this is not the default value)
|
||||
# when hosting a public server with a router that lacks Hairpin NAT support, make sure the hosts file on this system
|
||||
# has the host name of the system set to resolve to it's local IP address on the network.
|
||||
public = 127.0.0.1
|
||||
|
||||
# Login server configuration
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ class LoginActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], conne
|
|||
|
||||
private val serverName: String = Config.app.world.serverName
|
||||
private val gameTestServerAddress = new InetSocketAddress(InetAddress.getByName(Config.app.public), Config.app.world.port)
|
||||
private val localHost: InetAddress = InetAddress.getLocalHost
|
||||
|
||||
private val bcryptRounds = 12
|
||||
|
||||
|
|
@ -152,7 +153,7 @@ class LoginActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], conne
|
|||
updateServerList()
|
||||
|
||||
case SocketPane.NextPort(_, _, portNum) =>
|
||||
val address = gameTestServerAddress.getAddress.getHostAddress
|
||||
val address = if (ipAddress == "127.0.0.1") ipAddress else if (ipAddress.startsWith("192.168")) localHost.getHostAddress else gameTestServerAddress.getAddress.getHostAddress
|
||||
log.info(s"Connecting to ${address.toLowerCase}: $portNum ...")
|
||||
val response = ConnectToWorldMessage(serverName, address, portNum)
|
||||
context.become(idlingBehavior)
|
||||
|
|
@ -165,7 +166,7 @@ class LoginActor(middlewareActor: typed.ActorRef[MiddlewareActor.Command], conne
|
|||
|
||||
private def waitingForServerTransferBehavior: Receive = persistentSetupMixinBehavior.orElse {
|
||||
case SocketPane.NextPort(_, _, portNum) =>
|
||||
val address = gameTestServerAddress.getAddress.getHostAddress
|
||||
val address = if (ipAddress == "127.0.0.1") ipAddress else if (ipAddress.startsWith("192.168")) localHost.getHostAddress else gameTestServerAddress.getAddress.getHostAddress
|
||||
log.info(s"Connecting to ${address.toLowerCase}: $portNum ...")
|
||||
val response = ConnectToWorldMessage(serverName, address, portNum)
|
||||
context.become(idlingBehavior)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue