File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments