Skip to content

Commit 3145947

Browse files
committed
fixup
1 parent 25c9ceb commit 3145947

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/web/websocket/frame.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ let bufIdx = 0
1111

1212
try {
1313
crypto = require('node:crypto')
14-
buffer = crypto.randomFillSync(Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE)
1514
/* c8 ignore next 3 */
1615
} catch {
1716

@@ -31,6 +30,9 @@ class WebsocketFrameSend {
3130
*/
3231
constructor (data) {
3332
this.frameData = data
33+
if (buffer === null) {
34+
buffer = crypto.randomFillSync(Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE)
35+
}
3436
this.maskKey = generateMask()
3537
}
3638

0 commit comments

Comments
 (0)