Skip to content

Commit

Permalink
Respect initial settings for websocket
Browse files Browse the repository at this point in the history
  • Loading branch information
martenrichter committed Jan 2, 2024
1 parent 7df1db8 commit ade25ab
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions main/lib/http2/browser/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class Http2WebTransportBrowser {
ws: this.clientInt,
nativesession,
isclient: true,
initialStreamSendWindowOffset: this.initialStreamFlowControlWindow,
initialStreamSendWindowOffset: 0,
initialStreamReceiveWindowOffset:
this.initialStreamFlowControlWindow,
streamShouldAutoTuneReceiveWindow:
Expand Down Expand Up @@ -200,7 +200,7 @@ export class Http2WebTransportBrowser {
})
return session
},
sendWindowOffset: this.sessionFlowControlWindowSizeLimit,
sendWindowOffset: 0,
receiveWindowOffset: this.sessionFlowControlWindowSizeLimit,
shouldAutoTuneReceiveWindow: this.sessionShouldAutoTuneReceiveWindow,
receiveWindowSizeLimit: this.sessionFlowControlWindowSizeLimit
Expand Down
2 changes: 1 addition & 1 deletion main/lib/http2/node/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class Http2WebTransportClient {
stream,
nativesession,
isclient: true,
initialStreamSendWindowOffset: this.initialStreamFlowControlWindow,
initialStreamSendWindowOffset: this.initialStreamFlowControlWindow, // TODO, once supported by node, use initial settings
initialStreamReceiveWindowOffset:
this.initialStreamFlowControlWindow,
streamShouldAutoTuneReceiveWindow:
Expand Down
29 changes: 15 additions & 14 deletions main/lib/http2/node/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ export class Http2WebTransportServer {
stream,
nativesession,
isclient: false,
initialStreamSendWindowOffset:
this.initialStreamFlowControlWindow,
initialStreamSendWindowOffset: 0,
initialStreamReceiveWindowOffset:
this.initialStreamFlowControlWindow,
streamShouldAutoTuneReceiveWindow:
Expand All @@ -159,7 +158,7 @@ export class Http2WebTransportServer {
if (head.byteLength > 0) parse.parseData(head)
return parse
},
sendWindowOffset: this.sessionFlowControlWindowSizeLimit,
sendWindowOffset: 0,
receiveWindowOffset: this.sessionFlowControlWindowSizeLimit,
shouldAutoTuneReceiveWindow:
this.sessionShouldAutoTuneReceiveWindow,
Expand Down Expand Up @@ -246,7 +245,7 @@ export class Http2WebTransportServer {
nativesession,
isclient: false,
initialStreamSendWindowOffset:
this.initialStreamFlowControlWindow,
this.initialStreamFlowControlWindow, // TODO, once supported by node, use initial settings
initialStreamReceiveWindowOffset:
this.initialStreamFlowControlWindow,
streamShouldAutoTuneReceiveWindow:
Expand All @@ -259,8 +258,7 @@ export class Http2WebTransportServer {
stream,
nativesession,
isclient: false,
initialStreamSendWindowOffset:
this.initialStreamFlowControlWindow,
initialStreamSendWindowOffset: 0,
initialStreamReceiveWindowOffset:
this.initialStreamFlowControlWindow,
streamShouldAutoTuneReceiveWindow:
Expand All @@ -270,7 +268,9 @@ export class Http2WebTransportServer {
}))
}
},
sendWindowOffset: this.sessionFlowControlWindowSizeLimit,
sendWindowOffset: !websocketProt
? this.sessionFlowControlWindowSizeLimit
: 0, // TODO, once supported by node, use initial settings
receiveWindowOffset: this.sessionFlowControlWindowSizeLimit,
shouldAutoTuneReceiveWindow:
this.sessionShouldAutoTuneReceiveWindow,
Expand Down Expand Up @@ -421,8 +421,7 @@ export class Http2WebTransportServer {
stream,
nativesession,
isclient: false,
initialStreamSendWindowOffset:
this.initialStreamFlowControlWindow,
initialStreamSendWindowOffset: 0,
initialStreamReceiveWindowOffset:
this.initialStreamFlowControlWindow,
streamShouldAutoTuneReceiveWindow:
Expand All @@ -433,7 +432,7 @@ export class Http2WebTransportServer {
if (head && head.byteLength > 0) parse.parseData(head)
return parse
},
sendWindowOffset: this.sessionFlowControlWindowSizeLimit,
sendWindowOffset: 0,
receiveWindowOffset: this.sessionFlowControlWindowSizeLimit,
shouldAutoTuneReceiveWindow:
this.sessionShouldAutoTuneReceiveWindow,
Expand Down Expand Up @@ -462,7 +461,7 @@ export class Http2WebTransportServer {
nativesession,
isclient: false,
initialStreamSendWindowOffset:
this.initialStreamFlowControlWindow,
this.initialStreamFlowControlWindow, // TODO, once supported by node, use initial settings
initialStreamReceiveWindowOffset:
this.initialStreamFlowControlWindow,
streamShouldAutoTuneReceiveWindow:
Expand All @@ -475,8 +474,7 @@ export class Http2WebTransportServer {
stream,
nativesession,
isclient: false,
initialStreamSendWindowOffset:
this.initialStreamFlowControlWindow,
initialStreamSendWindowOffset: 0,
initialStreamReceiveWindowOffset:
this.initialStreamFlowControlWindow,
streamShouldAutoTuneReceiveWindow:
Expand All @@ -486,7 +484,10 @@ export class Http2WebTransportServer {
}))
}
},
sendWindowOffset: this.sessionFlowControlWindowSizeLimit,
sendWindowOffset:
protocol !== 'websocket'
? this.sessionFlowControlWindowSizeLimit
: 0, // TODO, once supported by node, use initial settings
receiveWindowOffset: this.sessionFlowControlWindowSizeLimit,
shouldAutoTuneReceiveWindow:
this.sessionShouldAutoTuneReceiveWindow,
Expand Down
3 changes: 3 additions & 0 deletions main/lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ export class HttpWTSession {
this.objint = object
this.objint.jsobj = this
this.reliable = !!reliable
if (this.objint.sendInitialParameters) {
this.objint.sendInitialParameters()
}
}
}

Expand Down

0 comments on commit ade25ab

Please sign in to comment.