From 96859316947f562744b69cdffcbdda85215b6c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Fri, 26 Jul 2024 13:25:19 +0800 Subject: [PATCH] fix: uint --- src/common/utils/MessageUnique.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/utils/MessageUnique.ts b/src/common/utils/MessageUnique.ts index 30a65cb4..30c4d09d 100644 --- a/src/common/utils/MessageUnique.ts +++ b/src/common/utils/MessageUnique.ts @@ -74,7 +74,7 @@ class MessageUniqueWrapper { createMsg(peer: Peer, msgId: string): number | undefined { const key = `${msgId}|${peer.chatType}|${peer.peerUid}`; const hash = crypto.createHash('sha1').update(key); - const shortId = parseInt(hash.digest('hex').slice(0, 8), 16); + const shortId = Buffer.from(hash.digest('hex').slice(0, 8),'hex').readInt32BE(); const isExist = this.msgIdMap.getKey(shortId); //console.log(`${peer.peerUid} ${msgId} ------- ${shortId}`); if (isExist && isExist === msgId) {