uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.76k stars 563 forks source link

UpgradeAsync.js function doesn't use cork #924

Closed gabisrm closed 1 year ago

gabisrm commented 1 year ago

Since last upgrade, I've noticed the cork warning and properly fixed all those places where it was missing.

The thing is that it's also happenning in my upgrade function, which has an async method to verify some credentials. My code was adapted from the UpgradeAsync.js example, and I've seen that the res.upgrade method inside the setTimeout() to simulate an async function is not wrapped in a cork.

Following the UpgradeAsync.js example, it seems to indicate that res.updgrade doesn't need to be wrapped in a cork method.

My question is if the example needs to be updated to wrap the res.upgrade in the cork function, or if I'm doing something wrong in my upgrade handler.

Thanks in advance.

e3dio commented 1 year ago

Yes all async responses need to be corked including res.upgrade