mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-29 12:02:45 +00:00
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:
parent
cf7c4832fe
commit
2a467a48dc
@ -58,13 +58,21 @@ public final class GameServer extends KcpServer {
|
|||||||
private final CombineManger combineManger;
|
private final CombineManger combineManger;
|
||||||
private final TowerScheduleManager towerScheduleManager;
|
private final TowerScheduleManager towerScheduleManager;
|
||||||
|
|
||||||
public GameServer() {
|
private static InetSocketAddress getAdapterInetSocketAddress(){
|
||||||
this(new InetSocketAddress(
|
InetSocketAddress inetSocketAddress = null;
|
||||||
|
if(GAME_INFO.bindAddress.equals("")){
|
||||||
|
inetSocketAddress=new InetSocketAddress(GAME_INFO.bindPort);
|
||||||
|
}else{
|
||||||
|
inetSocketAddress=new InetSocketAddress(
|
||||||
GAME_INFO.bindAddress,
|
GAME_INFO.bindAddress,
|
||||||
GAME_INFO.bindPort
|
GAME_INFO.bindPort
|
||||||
));
|
);
|
||||||
|
}
|
||||||
|
return inetSocketAddress;
|
||||||
|
}
|
||||||
|
public GameServer() {
|
||||||
|
this(getAdapterInetSocketAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameServer(InetSocketAddress address) {
|
public GameServer(InetSocketAddress address) {
|
||||||
super(address);
|
super(address);
|
||||||
|
|
||||||
|
@ -129,7 +129,11 @@ public final class HttpServer {
|
|||||||
*/
|
*/
|
||||||
public void start() {
|
public void start() {
|
||||||
// Attempt to start the HTTP server.
|
// Attempt to start the HTTP server.
|
||||||
|
if(HTTP_INFO.bindAddress.equals("")){
|
||||||
|
this.express.listen(HTTP_INFO.bindPort);
|
||||||
|
}else{
|
||||||
this.express.listen(HTTP_INFO.bindAddress, HTTP_INFO.bindPort);
|
this.express.listen(HTTP_INFO.bindAddress, HTTP_INFO.bindPort);
|
||||||
|
}
|
||||||
|
|
||||||
// Log bind information.
|
// Log bind information.
|
||||||
Grasscutter.getLogger().info(translate("messages.dispatch.port_bind", Integer.toString(this.express.raw().port())));
|
Grasscutter.getLogger().info(translate("messages.dispatch.port_bind", Integer.toString(this.express.raw().port())));
|
||||||
|
Loading…
Reference in New Issue
Block a user