use of com.tvd12.ezyfoxserver.client.request.EzyRequest in project ezyfox-server by youngmonkeys.
the class EzySimpleDataHandler method handleRequest.
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void handleRequest(EzyConstant cmd, EzyArray data) {
try {
EzyRequest request = newRequest(cmd, data);
try {
EzyInterceptor interceptor = controllers.getInterceptor(cmd);
interceptor.intercept(context, request);
EzyController controller = controllers.getController(cmd);
controller.handle(context, request);
} finally {
request.release();
}
} catch (Exception e) {
if (context != null) {
Throwable throwable = requestHandleException(session, cmd, data, e);
context.handleException(Thread.currentThread(), throwable);
} else {
if (active) {
logger.warn("fatal error, please add an issue to ezyfox-server github " + "with log: {}\nand stacktrace: ", this, e);
} else {
logger.warn("can't handle command: {} and data: {}, this session " + "maybe destroyed (session: {}), error message: {}", cmd, data, session, e.getMessage());
}
}
}
}
use of com.tvd12.ezyfoxserver.client.request.EzyRequest in project ezyfox-server-android-client by youngmonkeys.
the class EzyTcpClient method send.
@Override
public void send(EzyRequest request, boolean encrypted) {
Object cmd = request.getCommand();
EzyData data = request.serialize();
send((EzyCommand) cmd, (EzyArray) data, encrypted);
}
use of com.tvd12.ezyfoxserver.client.request.EzyRequest in project ezyfox-server-android-client by youngmonkeys.
the class EzyPingSchedule method sendPingRequest.
private void sendPingRequest() {
int lostPingCount = pingManager.increaseLostPingCount();
int maxLostPingCount = pingManager.getMaxLostPingCount();
if (lostPingCount >= maxLostPingCount) {
client.getSocket().disconnect(EzyDisconnectReason.SERVER_NOT_RESPONDING.getId());
} else {
EzyRequest request = new EzyPingRequest();
client.send(request);
}
if (lostPingCount > 1) {
EzyLogger.info("lost ping count: " + lostPingCount);
EzyLostPingEvent event = new EzyLostPingEvent(lostPingCount);
socketEventQueue.addEvent(event);
}
}
use of com.tvd12.ezyfoxserver.client.request.EzyRequest in project ezyfox-server by youngmonkeys.
the class EzyUserDataHandler method newRequest.
@SuppressWarnings({ "rawtypes" })
protected EzyRequest newRequest(EzyConstant cmd, EzyArray data) {
EzySimpleRequest request = requestFactory.newRequest(cmd);
request.setSession(session);
request.setUser(user);
request.deserializeParams(data);
return request;
}
use of com.tvd12.ezyfoxserver.client.request.EzyRequest in project ezyfox-server-android-client by youngmonkeys.
the class EzyConnectionSuccessHandler method sendHandshakeRequest.
protected void sendHandshakeRequest() {
EzyRequest request = newHandshakeRequest();
client.send(request);
}
Aggregations