Skip to content

Commit 54850d3

Browse files
committed
extend timeout
1 parent 7936dae commit 54850d3

4 files changed

Lines changed: 10 additions & 11 deletions

File tree

src/main/java/cn/ussshenzhou/channel/subspace/client/SubspaceConnection.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class SubspaceConnection {
2727
private static Protocol protocol;
2828
private static SecurityLevel securityLevel;
2929
private static final EventLoopGroup EVENT_LOOP_GROUP = new MultiThreadIoEventLoopGroup(1, new DefaultThreadFactory("Channel-Client-Subspace", true), NioIoHandler.newFactory());
30-
;
3130
private static volatile Channel channel;
3231
private static volatile boolean activelyDisconnect;
3332
private static ScheduledFuture<?> reconnectFuture;
@@ -214,19 +213,19 @@ protected void initChannel(SocketChannel ch) {
214213
LogUtils.getLogger().info("Disconnected from subspace.");
215214
activelyDisconnect = false;
216215
} else {
217-
LogUtils.getLogger().warn("Disconnected from subspace. Reconnecting in 10s...");
216+
LogUtils.getLogger().warn("Disconnected from subspace. Reconnecting in 30s...");
218217
MicrophoneHud.setStatus(MicrophoneHud.Status.SUBSPACE);
219-
reconnectFuture = EVENT_LOOP_GROUP.schedule(() -> connect(packet), 10, TimeUnit.SECONDS);
218+
reconnectFuture = EVENT_LOOP_GROUP.schedule(() -> connect(packet), 30, TimeUnit.SECONDS);
220219
}
221220
channel = null;
222221
});
223222
send(new HandshakePacket());
224223
LogUtils.getLogger().info("Subspace connected. Sending HandshakePacket");
225224
MicrophoneHud.resumeStatus();
226225
} else {
227-
LogUtils.getLogger().error("Failed to connect to subspace server. Try again in 10s...");
226+
LogUtils.getLogger().error("Failed to connect to subspace server. Try again in 30s...");
228227
MicrophoneHud.setStatus(MicrophoneHud.Status.SUBSPACE);
229-
reconnectFuture = EVENT_LOOP_GROUP.schedule(() -> connect(packet), 10, TimeUnit.SECONDS);
228+
reconnectFuture = EVENT_LOOP_GROUP.schedule(() -> connect(packet), 30, TimeUnit.SECONDS);
230229
channel = null;
231230
}
232231
});

src/main/java/cn/ussshenzhou/channel/subspace/server/SubspaceConnection.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ protected void initChannel(SocketChannel ch) {
7474
LogUtils.getLogger().info("Disconnected from subspace.");
7575
activelyDisconnect = false;
7676
} else {
77-
LogUtils.getLogger().warn("Disconnected from subspace. Reconnecting in 10s...");
78-
eventLoopGroup.schedule(SubspaceConnection::connect, 10, TimeUnit.SECONDS);
77+
LogUtils.getLogger().warn("Disconnected from subspace. Reconnecting in 30s...");
78+
eventLoopGroup.schedule(SubspaceConnection::connect, 30, TimeUnit.SECONDS);
7979
}
8080
channel = null;
8181
});
@@ -85,8 +85,8 @@ protected void initChannel(SocketChannel ch) {
8585
ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers().forEach(SubspaceConnection::newPlayer);
8686
}
8787
} else {
88-
LogUtils.getLogger().error("Failed to connect to subspace server. Try again in 10s...");
89-
eventLoopGroup.schedule(SubspaceConnection::connect, 10, TimeUnit.SECONDS);
88+
LogUtils.getLogger().error("Failed to connect to subspace server. Try again in 30s...");
89+
eventLoopGroup.schedule(SubspaceConnection::connect, 30, TimeUnit.SECONDS);
9090
channel = null;
9191
}
9292
});

subspace/src/network/ClientTcpConnection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace subspace {
4949
socket.set_option(asio::ip::tcp::no_delay(true));
5050
remoteAddress = socket.remote_endpoint().address().to_string() + ":" + std::to_string(socket.remote_endpoint().port());
5151
spdlog::info("Client connecting from {}", getRemoteAddress());
52-
handshakeTimer.expires_after(std::chrono::seconds(5));
52+
handshakeTimer.expires_after(std::chrono::seconds(10));
5353
handshakeTimer.async_wait([thiz = std::dynamic_pointer_cast<ClientTcpConnection>(shared_from_this())](const std::error_code& ec) {
5454
if (ec) {
5555
return;

subspace/src/network/ServerConnection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace subspace {
1212
socket.set_option(asio::ip::tcp::no_delay(true));
1313
remoteAddress = socket.remote_endpoint().address().to_string() + ":" + std::to_string(socket.remote_endpoint().port());
1414
spdlog::info("Minecraft Server connecting, from {}", getRemoteAddress());
15-
handshakeTimer.expires_from_now(std::chrono::seconds(3));
15+
handshakeTimer.expires_from_now(std::chrono::seconds(10));
1616
handshakeTimer.async_wait([thiz = std::dynamic_pointer_cast<ServerConnection>(shared_from_this())](const std::error_code& ec) {
1717
if (ec) {
1818
return;

0 commit comments

Comments
 (0)