Адаптер сервера и смена ореинтации отмены событий (теперь адаптер должен вернуть true чтобы продолжить обработку пакета и false если пакет обрабатывать не нужно)
This commit is contained in:
@@ -130,9 +130,9 @@ public class Server extends WebSocketServer {
|
||||
PacketExecutor executor = executorClass.getConstructor().newInstance();
|
||||
executor.settings = this.settings;
|
||||
executor.context = this.context;
|
||||
if(listener != null && listener.onPacketReceived(this, client, packet)) {
|
||||
if(listener != null && !listener.onPacketReceived(this, client, packet)) {
|
||||
/**
|
||||
* Если слушатель сервера вернул true, пакет не обрабатываем.
|
||||
* Если слушатель сервера вернул false, пакет не обрабатываем.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public class Server extends WebSocketServer {
|
||||
if(this.listener == null){
|
||||
return;
|
||||
}
|
||||
if(this.listener.onClientConnect(this, client)) {
|
||||
if(!this.listener.onClientConnect(this, client)) {
|
||||
client.disconnect(ServerFailures.SERVER_NOT_ACCEPT_CLIENT);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user