Skip to content

Commit

Permalink
test(sio): bump uWebSockets.js to version 20.48.0
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Sep 19, 2024
1 parent 19c48a4 commit c79cd0e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"ts-node": "^10.9.2",
"tsd": "^0.31.1",
"typescript": "^5.5.3",
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.30.0",
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.48.0",
"wdio-geckodriver-service": "^5.0.2"
}
}
32 changes: 17 additions & 15 deletions packages/socket.io/lib/uws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,27 @@ export function serveFile(res /* : HttpResponse */, filepath: string) {
const onDataChunk = (chunk: Buffer) => {
const arrayBufferChunk = toArrayBuffer(chunk);

const lastOffset = res.getWriteOffset();
const [ok, done] = res.tryEnd(arrayBufferChunk, size);
res.cork(() => {
const lastOffset = res.getWriteOffset();
const [ok, done] = res.tryEnd(arrayBufferChunk, size);

if (!done && !ok) {
readStream.pause();
if (!done && !ok) {
readStream.pause();

res.onWritable((offset) => {
const [ok, done] = res.tryEnd(
arrayBufferChunk.slice(offset - lastOffset),
size,
);
res.onWritable((offset) => {
const [ok, done] = res.tryEnd(
arrayBufferChunk.slice(offset - lastOffset),
size,
);

if (!done && ok) {
readStream.resume();
}
if (!done && ok) {
readStream.resume();
}

return ok;
});
}
return ok;
});
}
});
};

res.onAborted(destroyReadStream);
Expand Down

0 comments on commit c79cd0e

Please sign in to comment.