-
Notifications
You must be signed in to change notification settings - Fork 356
fixes bug with incorrect WS framesize setup. #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR provides a websocket transport's frame size setup with regards of current RSocket fragment size. Current implementation provides the following setup rules: * if `mtu` is 0 (means no fragmentation) - then WS frame size is equal to maximum default frame size of RSocket frame which is `16_777_215`; * if `mtu` is GT > 0 and LT < 65536 (default for WS frame size) then the WS frame size will be its the default one (which is `65536`); * if `mtu` is GT > 65536 then the WS frame size will be set to the specified by that parameter size Signed-off-by: Oleh Dokuka <[email protected]>
}) | ||
.bind() | ||
.map(CloseableChannel::new); | ||
} | ||
|
||
static final class UriPathTemplate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is port from Reactor-Netty internals
cc/
@violetagg
Signed-off-by: Oleh Dokuka <[email protected]>
...transport-netty/src/main/java/io/rsocket/transport/netty/server/WebsocketRouteTransport.java
Outdated
Show resolved
Hide resolved
@@ -114,6 +118,8 @@ public void setTransportHeaders(Supplier<Map<String, String>> transportHeaders) | |||
(request, response) -> { | |||
transportHeaders.get().forEach(response::addHeader); | |||
return response.sendWebsocket( | |||
null, | |||
Math.max(DEFAULT_FRAME_SIZE, mtu == 0 ? FRAME_MAX_SIZE : mtu), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this doing? Is there a reason we are setting the max frame size to anything but rsocket max frame size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the entire fragmentation logic is built on top of the assumption that mtu is higher than 0. So if mtu
is 0, then fragmentation is avoided. It means that max size of the fragment should be less || equal to maximum possible size frame. At least I was thinking like that when writing that code. In case 0xFFFFFF is a specific limit to fragmentation and in general payload size is unlimited (or limited to (Integer.MAX_VALUE - 2)
), then I can fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplified to max frame size for all possible cases
Signed-off-by: Oleh Dokuka <[email protected]>
Signed-off-by: Oleh Dokuka <[email protected]>
Signed-off-by: Oleh Dokuka <[email protected]>
* fixes buf with incorrect WS framesize setup. This PR provides a websocket transport's frame size setup with regards of current RSocket fragment size. Current implementation provides the following setup rules: * if `mtu` is 0 (means no fragmentation) - then WS frame size is equal to maximum default frame size of RSocket frame which is `16_777_215`; * if `mtu` is GT > 0 and LT < 65536 (default for WS frame size) then the WS frame size will be its the default one (which is `65536`); * if `mtu` is GT > 65536 then the WS frame size will be set to the specified by that parameter size Signed-off-by: Oleh Dokuka <[email protected]> * rollbacks commented docs build * fixes format Signed-off-by: Oleh Dokuka <[email protected]> * cleanup pollution uses max frame size from `FrameLengthFlyweight` Signed-off-by: Oleh Dokuka <[email protected]> * simplifies logic of max frame size setup for ws transport Signed-off-by: Oleh Dokuka <[email protected]> * fixes google java format Signed-off-by: Oleh Dokuka <[email protected]> Signed-off-by: Maksym Ostroverkhov <[email protected]>
Signed-off-by: Oleh Dokuka <[email protected]>
* backports fixes bug with incorrect WS framesize setup (#614) * rollback mockito version * changed timeout * changed timeout * small fix * replace with concurrent maps Signed-off-by: Oleh Dokuka <[email protected]>
This PR provides a WebSocket transport's frame size setup with regards
of current RSocket fragment size.
Signed-off-by: Oleh Dokuka [email protected]