mirror of
https://github.com/WuKongIM/WuKongIMAndroidSDK
synced 2025-06-03 23:58:19 +00:00
fix:Add logs
This commit is contained in:
parent
c7a468a2b0
commit
9978523a9a
@ -91,7 +91,7 @@ public class WKConnection {
|
|||||||
private String lastRequestId;
|
private String lastRequestId;
|
||||||
private int unReceivePongCount = 0;
|
private int unReceivePongCount = 0;
|
||||||
public volatile Handler reconnectionHandler = new Handler(Objects.requireNonNull(Looper.myLooper()));
|
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;
|
Runnable reconnectionRunnable = this::reconnection;
|
||||||
private int connCount = 0;
|
private int connCount = 0;
|
||||||
|
|
||||||
@ -168,11 +168,13 @@ public class WKConnection {
|
|||||||
connectionClient = new ConnectionClient(iNonBlockingConnection -> {
|
connectionClient = new ConnectionClient(iNonBlockingConnection -> {
|
||||||
connCount = 0;
|
connCount = 0;
|
||||||
if (iNonBlockingConnection == null || connection == null || !connection.getId().equals(iNonBlockingConnection.getId())) {
|
if (iNonBlockingConnection == null || connection == null || !connection.getId().equals(iNonBlockingConnection.getId())) {
|
||||||
|
WKLoggerUtils.getInstance().e(TAG,"重复连接");
|
||||||
forcedReconnection();
|
forcedReconnection();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Object att = iNonBlockingConnection.getAttachment();
|
Object att = iNonBlockingConnection.getAttachment();
|
||||||
if (att == null || !att.equals(socketSingleID)) {
|
if (att == null || !att.equals(socketSingleID)) {
|
||||||
|
WKLoggerUtils.getInstance().e(TAG,"不属于当前连接");
|
||||||
forcedReconnection();
|
forcedReconnection();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -220,6 +220,7 @@ class WKProto {
|
|||||||
receivedMsg.topicID = wkRead.readString();
|
receivedMsg.topicID = wkRead.readString();
|
||||||
}
|
}
|
||||||
String content = wkRead.readPayload();
|
String content = wkRead.readPayload();
|
||||||
|
WKLoggerUtils.getInstance().e(TAG, "消息payload:" + content);
|
||||||
receivedMsg.payload = CryptoUtils.getInstance().aesDecrypt(CryptoUtils.getInstance().base64Decode(content));
|
receivedMsg.payload = CryptoUtils.getInstance().aesDecrypt(CryptoUtils.getInstance().base64Decode(content));
|
||||||
String msgKey = receivedMsg.messageID
|
String msgKey = receivedMsg.messageID
|
||||||
+ receivedMsg.messageSeq
|
+ receivedMsg.messageSeq
|
||||||
|
@ -102,10 +102,10 @@ public class CryptoUtils {
|
|||||||
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException |
|
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException |
|
||||||
InvalidAlgorithmParameterException | IllegalBlockSizeException |
|
InvalidAlgorithmParameterException | IllegalBlockSizeException |
|
||||||
BadPaddingException e) {
|
BadPaddingException e) {
|
||||||
WKLoggerUtils.getInstance().e(TAG,"aesEncrypt encrypt error");
|
WKLoggerUtils.getInstance().e(TAG, "aesEncrypt encrypt error");
|
||||||
}
|
}
|
||||||
if (encrypted == null) {
|
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();
|
encrypted = sSrc.getBytes();
|
||||||
}
|
}
|
||||||
return encrypted;
|
return encrypted;
|
||||||
@ -136,8 +136,9 @@ public class CryptoUtils {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public byte[] base64Decode(String data) {
|
public byte[] base64Decode(String data) {
|
||||||
return Base64.decode(data, Base64.NO_WRAP);
|
return Base64.decode(data, Base64.NO_WRAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user