fix:Add logs

This commit is contained in:
SL 2025-01-06 22:16:23 +08:00
parent c7a468a2b0
commit 9978523a9a
3 changed files with 8 additions and 4 deletions

View File

@ -91,7 +91,7 @@ public class WKConnection {
private String lastRequestId;
private int unReceivePongCount = 0;
public volatile Handler reconnectionHandler = new Handler(Objects.requireNonNull(Looper.myLooper()));
// private final Handler mainHandler = new Handler(Looper.getMainLooper());
// private final Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable reconnectionRunnable = this::reconnection;
private int connCount = 0;
@ -168,11 +168,13 @@ public class WKConnection {
connectionClient = new ConnectionClient(iNonBlockingConnection -> {
connCount = 0;
if (iNonBlockingConnection == null || connection == null || !connection.getId().equals(iNonBlockingConnection.getId())) {
WKLoggerUtils.getInstance().e(TAG,"重复连接");
forcedReconnection();
return;
}
Object att = iNonBlockingConnection.getAttachment();
if (att == null || !att.equals(socketSingleID)) {
WKLoggerUtils.getInstance().e(TAG,"不属于当前连接");
forcedReconnection();
return;
}

View File

@ -220,6 +220,7 @@ class WKProto {
receivedMsg.topicID = wkRead.readString();
}
String content = wkRead.readPayload();
WKLoggerUtils.getInstance().e(TAG, "消息payload:" + content);
receivedMsg.payload = CryptoUtils.getInstance().aesDecrypt(CryptoUtils.getInstance().base64Decode(content));
String msgKey = receivedMsg.messageID
+ receivedMsg.messageSeq

View File

@ -102,10 +102,10 @@ public class CryptoUtils {
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException |
InvalidAlgorithmParameterException | IllegalBlockSizeException |
BadPaddingException e) {
WKLoggerUtils.getInstance().e(TAG,"aesEncrypt encrypt error");
WKLoggerUtils.getInstance().e(TAG, "aesEncrypt encrypt error");
}
if (encrypted == null) {
WKLoggerUtils.getInstance().e(TAG,"aesEncrypt The encrypted data is empty");
WKLoggerUtils.getInstance().e(TAG, "aesEncrypt The encrypted data is empty");
encrypted = sSrc.getBytes();
}
return encrypted;
@ -136,8 +136,9 @@ public class CryptoUtils {
return content;
}
public byte[] base64Decode(String data) {
return Base64.decode(data, Base64.NO_WRAP);
return Base64.decode(data, Base64.NO_WRAP);
}
/**