Skip to content

Commit

Permalink
fix: check closed status of socket during callbacks
Browse files Browse the repository at this point in the history
Sometimes calling `getSendQueueCount` can cause an internal crash,
I think it may be because packets are being sent during server
shutdown - guarding on the `this.closed` property similar to the
`sendPacket` method avoids the crash.
  • Loading branch information
achingbrain authored and martenrichter committed Mar 4, 2024
1 parent 17576fa commit 4cda654
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions transports/http3-quiche/lib/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export class Http3WebTransportSocket {
}

doProcessBufferedChlos() {
if (this.closed) {
return
}

this.cobj.processBufferedChlos()
this.chlosSched = false
}
Expand All @@ -110,6 +114,10 @@ export class Http3WebTransportSocket {
}

packetSendCB() {
if (this.closed) {
return
}

// @ts-ignore
if (this.socketInt.getSendQueueCount() === 0 && this.blocked) {
this.cobj.onCanWrite()
Expand Down

0 comments on commit 4cda654

Please sign in to comment.