mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX][EXPERIMENTAL] Фикс возможных проблем с requestUUID
This commit is contained in:
parent
fcacd4fe12
commit
6a70a23556
1 changed files with 9 additions and 1 deletions
|
@ -40,6 +40,7 @@
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public class WebSocketService {
|
public class WebSocketService {
|
||||||
|
@ -67,16 +68,23 @@ void process(ChannelHandlerContext ctx, TextWebSocketFrame frame, Client client)
|
||||||
{
|
{
|
||||||
if(server.config.netty.proxy.requests.contains(response.getType()))
|
if(server.config.netty.proxy.requests.contains(response.getType()))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
UUID origRequestUUID = null;
|
||||||
if(response instanceof SimpleResponse)
|
if(response instanceof SimpleResponse)
|
||||||
{
|
{
|
||||||
SimpleResponse simpleResponse = (SimpleResponse) response;
|
SimpleResponse simpleResponse = (SimpleResponse) response;
|
||||||
simpleResponse.server = server;
|
simpleResponse.server = server;
|
||||||
simpleResponse.service = this;
|
simpleResponse.service = this;
|
||||||
simpleResponse.ctx = ctx;
|
simpleResponse.ctx = ctx;
|
||||||
|
origRequestUUID = simpleResponse.requestUUID;
|
||||||
}
|
}
|
||||||
LogHelper.debug("Proxy %s request", response.getType());
|
LogHelper.debug("Proxy %s request", response.getType());
|
||||||
if(client.session == 0) client.session = new Random().nextLong();
|
if(client.session == 0) client.session = new Random().nextLong();
|
||||||
ProxyRequest proxyRequest = new ProxyRequest(response, client.session);
|
ProxyRequest proxyRequest = new ProxyRequest(response, client.session);
|
||||||
|
if(response instanceof SimpleResponse)
|
||||||
|
{
|
||||||
|
((SimpleResponse) response).requestUUID = proxyRequest.requestUUID;
|
||||||
|
}
|
||||||
proxyRequest.isCheckSign = client.checkSign;
|
proxyRequest.isCheckSign = client.checkSign;
|
||||||
try {
|
try {
|
||||||
ResultInterface result = proxyRequest.request();
|
ResultInterface result = proxyRequest.request();
|
||||||
|
@ -90,7 +98,7 @@ void process(ChannelHandlerContext ctx, TextWebSocketFrame frame, Client client)
|
||||||
}
|
}
|
||||||
if(result instanceof Request && response instanceof SimpleResponse)
|
if(result instanceof Request && response instanceof SimpleResponse)
|
||||||
{
|
{
|
||||||
((Request) result).requestUUID = ((SimpleResponse) response).requestUUID;
|
((Request) result).requestUUID = origRequestUUID;
|
||||||
}
|
}
|
||||||
sendObject(ctx, result);
|
sendObject(ctx, result);
|
||||||
} catch (RequestException e)
|
} catch (RequestException e)
|
||||||
|
|
Loading…
Reference in a new issue