Fix connection bugs without removing binding address (#993)

* Fix connection bugs according to #921

Fix this for connect to game by local device or remote devices according to #921

* Fix connection bugs according to #921

same

* Update GameServer.java

* fix build

* Update GameServer.java
This commit is contained in:
zhaodice
2022-05-19 23:35:14 +08:00
committed by GitHub
parent cf7c4832fe
commit 2a467a48dc
2 changed files with 19 additions and 7 deletions

View File

@@ -58,13 +58,21 @@ public final class GameServer extends KcpServer {
private final CombineManger combineManger;
private final TowerScheduleManager towerScheduleManager;
public GameServer() {
this(new InetSocketAddress(
GAME_INFO.bindAddress,
GAME_INFO.bindPort
));
private static InetSocketAddress getAdapterInetSocketAddress(){
InetSocketAddress inetSocketAddress = null;
if(GAME_INFO.bindAddress.equals("")){
inetSocketAddress=new InetSocketAddress(GAME_INFO.bindPort);
}else{
inetSocketAddress=new InetSocketAddress(
GAME_INFO.bindAddress,
GAME_INFO.bindPort
);
}
return inetSocketAddress;
}
public GameServer() {
this(getAdapterInetSocketAddress());
}
public GameServer(InetSocketAddress address) {
super(address);