SHA256
Обновить Telegram-бота, документацию и связанные доработки
This commit is contained in:
@@ -9,6 +9,7 @@ import server.logic.ws_protocol.JSON.ActiveConnectionsRegistry;
|
||||
import server.logic.ws_protocol.JSON.ConnectionContext;
|
||||
import server.logic.ws_protocol.JSON.JsonInboundProcessor;
|
||||
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
@@ -131,9 +132,19 @@ public class BlockchainWsEndpoint {
|
||||
|
||||
@OnWebSocketError
|
||||
public void onError(Throwable cause) {
|
||||
if (isNormalClosedChannel(cause)) {
|
||||
log.info("WS channel already closed during normal shutdown: {}", cause.toString());
|
||||
return;
|
||||
}
|
||||
log.error("WS error", cause);
|
||||
}
|
||||
|
||||
private boolean isNormalClosedChannel(Throwable cause) {
|
||||
if (cause == null) return false;
|
||||
if (cause instanceof ClosedChannelException) return true;
|
||||
return String.valueOf(cause).contains("ClosedChannelException");
|
||||
}
|
||||
|
||||
private void trySendJsonError() {
|
||||
if (session != null && session.isOpen()) {
|
||||
String resp = "{\"op\":null,\"requestId\":null,\"status\":500,"
|
||||
@@ -152,4 +163,4 @@ public class BlockchainWsEndpoint {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user