@nxtedition/shared 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -71,6 +71,8 @@ export function writer({ sharedState, sharedBuffer }) {
|
|
|
71
71
|
function tryWrite(maxLen, fn, opaque) {
|
|
72
72
|
readPos = Atomics.load(state, READ_INDEX)
|
|
73
73
|
|
|
74
|
+
maxLen += 4 // len
|
|
75
|
+
|
|
74
76
|
if (size - writePos < maxLen + 4) {
|
|
75
77
|
if (readPos < maxLen + 4) {
|
|
76
78
|
return false
|
|
@@ -120,7 +122,7 @@ export function writer({ sharedState, sharedBuffer }) {
|
|
|
120
122
|
dst.set(buf)
|
|
121
123
|
return buf.byteLength
|
|
122
124
|
},
|
|
123
|
-
|
|
125
|
+
buf
|
|
124
126
|
)
|
|
125
127
|
) {
|
|
126
128
|
const { async, value } = Atomics.waitAsync(state, READ_INDEX, readPos)
|
|
@@ -152,7 +154,7 @@ export function writer({ sharedState, sharedBuffer }) {
|
|
|
152
154
|
args = args[0]
|
|
153
155
|
}
|
|
154
156
|
|
|
155
|
-
len =
|
|
157
|
+
len = 0
|
|
156
158
|
for (const buf of args) {
|
|
157
159
|
len += buf.byteLength ?? buf.length * 3
|
|
158
160
|
}
|