Skip to content

Commit e1118a9

Browse files
committed
Fix test server sending and maxDatagram
1 parent 555142f commit e1118a9

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

test/datagrams.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe('datagrams', function () {
247247
const datagramsOutgoing = datagramsOutgoingPlan.map((el) => {
248248
const uint32arr = new Uint32Array(2)
249249
uint32arr[0] = el.bytesize
250-
uint32arr[1] = el.dasize
250+
uint32arr[1] = Math.ceil(el.dasize * 1000)
251251
return new Uint8Array(uint32arr.buffer)
252252
})
253253

test/fixtures/server.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,17 @@ export async function createServer() {
321321
if (value != null) {
322322
const mDatagramSize = session.datagrams.maxDatagramSize
323323
const tosend = new Uint32Array(value.buffer)
324-
const outarr = new Uint32Array(
325-
(tosend[0] +
324+
const outarr = new Uint8Array(
325+
tosend[0] +
326326
Math.min(
327327
Math.ceil(tosend[1] * mDatagramSize),
328328
10_000_000
329-
)) /
330-
Uint32Array.BYTES_PER_ELEMENT
329+
) /
330+
1000
331331
)
332-
outarr[0] = mDatagramSize
333-
outarr[1] = outarr.byteLength
332+
const outarr32 = new Uint32Array(outarr.buffer, 0, 2)
333+
outarr32[0] = mDatagramSize
334+
outarr32[1] = outarr.byteLength
334335
await writer.write(new Uint8Array(outarr.buffer))
335336
}
336337
}

0 commit comments

Comments
 (0)