mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
refactor: Change Sync Functions to Promises to Prevent Blocking Event Loop (#896)
* initial commit * lint * lint 2
This commit is contained in:
@@ -163,7 +163,7 @@ export const makeNoiseHandler = ({
|
||||
|
||||
return frame
|
||||
},
|
||||
decodeFrame: (newData: Buffer | Uint8Array, onFrame: (buff: Uint8Array | BinaryNode) => void) => {
|
||||
decodeFrame: async(newData: Buffer | Uint8Array, onFrame: (buff: Uint8Array | BinaryNode) => void) => {
|
||||
// the binary protocol uses its own framing mechanism
|
||||
// on top of the WS frames
|
||||
// so we get this data and separate out the frames
|
||||
@@ -184,7 +184,7 @@ export const makeNoiseHandler = ({
|
||||
|
||||
if(isFinished) {
|
||||
const result = decrypt(frame as Uint8Array)
|
||||
frame = decodeBinaryNode(result)
|
||||
frame = await decodeBinaryNode(result)
|
||||
}
|
||||
|
||||
logger.trace({ msg: (frame as any)?.attrs?.id }, 'recv frame')
|
||||
|
||||
Reference in New Issue
Block a user