mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: possible leak on waitForMessage
This commit is contained in:
@@ -123,12 +123,14 @@ export const makeSocket = ({
|
|||||||
|
|
||||||
ws.on(`TAG:${msgId}`, onRecv)
|
ws.on(`TAG:${msgId}`, onRecv)
|
||||||
ws.on('close', onErr) // if the socket closes, you'll never receive the message
|
ws.on('close', onErr) // if the socket closes, you'll never receive the message
|
||||||
|
ws.off('error', onErr)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
return result as any
|
return result as any
|
||||||
} finally {
|
} finally {
|
||||||
ws.off(`TAG:${msgId}`, onRecv)
|
ws.off(`TAG:${msgId}`, onRecv)
|
||||||
ws.off('close', onErr) // if the socket closes, you'll never receive the message
|
ws.off('close', onErr) // if the socket closes, you'll never receive the message
|
||||||
|
ws.off('error', onErr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** send a query, and wait for its response. auto-generates message ID if not provided */
|
/** send a query, and wait for its response. auto-generates message ID if not provided */
|
||||||
|
|||||||
Reference in New Issue
Block a user