44import org .wowtools .hppt .common .server .LoginClientService ;
55import org .wowtools .hppt .common .server .ServerSessionManager ;
66import org .wowtools .hppt .common .server .ServerTalker ;
7- import org .wowtools .hppt .common .util .BytesUtil ;
87import org .wowtools .hppt .common .util .GridAesCipherUtil ;
98import org .wowtools .hppt .run .ss .pojo .SsConfig ;
109import org .wowtools .hppt .run .ss .util .SsUtil ;
@@ -27,7 +26,6 @@ private final class ClientCell {
2726 LoginClientService .Client client ;
2827 volatile boolean running = true ;
2928 volatile boolean actived = true ;
30- final String reConnectToken = UUID .randomUUID ().toString ();
3129
3230 CTX ctx ;
3331 final LoginClientService .ClientActiveWatcher clientActiveWatcher = new LoginClientService .ClientActiveWatcher () {
@@ -133,36 +131,6 @@ public void receiveClientBytes(CTX ctx, byte[] bytes) {
133131 login = GridAesCipherUtil .encrypt (login );
134132 sendBytesToClient (ctx , login );
135133 break ;
136- case "reConnect" :
137- byte [] base64Bytes = BytesUtil .base642bytes (cmd [1 ]);
138- ClientCell currentClientCell = null ;
139- for (Map .Entry <CTX , ClientCell > entry : ctxClientCellMap .entrySet ()) {
140- ClientCell clientCell1 = entry .getValue ();
141- try {
142- byte [] decryptBytes = clientCell1 .client .aesCipherUtil .descriptor .decrypt (base64Bytes );
143- String [] codes = new String (decryptBytes , StandardCharsets .UTF_8 ).split (" " , 2 );
144- String reConnectCode = codes [0 ];
145- if (!clientCell1 .reConnectToken .equals (reConnectCode )) {
146- log .info ("重连token不匹配" );
147- continue ;
148- }
149- long st = Long .valueOf (codes [1 ]);
150- long now = System .currentTimeMillis ();
151- if (Math .abs (now - st ) > 60000 ) {
152- log .info ("重连时差过大 st {} now {}" , st , now );
153- continue ;
154- }
155- } catch (Exception e ) {
156- continue ;
157- }
158- currentClientCell = clientCell1 ;
159- break ;
160- }
161- if (currentClientCell != null ) {
162- ctxClientCellMap .put (ctx , currentClientCell );
163- log .info ("客户端重连成功 {}" , currentClientCell .client .clientId );
164- }
165- break ;
166134 default :
167135 log .warn ("未知命令 {} " , s );
168136 removeCtx (ctx );
0 commit comments