Page MenuHomePhabricator

[tunnelbroker] Make WebSocketSession generic
ClosedPublic

Authored by bartek on Sep 12 2023, 1:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 28, 6:23 PM
Unknown Object (File)
Mon, Oct 28, 9:37 AM
Unknown Object (File)
Tue, Oct 22, 9:10 AM
Unknown Object (File)
Tue, Oct 22, 9:10 AM
Unknown Object (File)
Tue, Oct 22, 9:09 AM
Unknown Object (File)
Tue, Oct 22, 5:04 AM
Unknown Object (File)
Oct 2 2024, 6:01 PM
Unknown Object (File)
Sep 15 2024, 1:38 PM
Subscribers

Details

Summary

We don't rely on specific websocket stream type, so this can be made generic.
This will be used in the next diff, where we will change TcpStream to a different type.

Depends on D9155

Test Plan

Tunnelbroker still builds, integration tests pass.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Sep 12 2023, 2:05 PM
bartek added inline comments.
services/tunnelbroker/src/websockets/mod.rs
110 ↗(On Diff #30990)

These are traits that all socket stream types implement

Is generic-ness of this is going to be helpful in the future? Or is it going to be always HyperWebsocket under the hood? Because in that case we should just remove the generics and use HyperWebsocket directly

Is generic-ness of this is going to be helpful in the future? Or is it going to be always HyperWebsocket under the hood? Because in that case we should just remove the generics and use HyperWebsocket directly

It's not HyperWebsocket but rather a type gathered from hyper_websocket.await.split(). Alternatively, we could simply hardcode WebSocketStream<Upgraded> which is the exact type returned by this fn, but I'm not a fan because such hardcoding is the reason I had to do this change.

Perhaps we can do better, but refactoring is not my goal here.

This revision is now accepted and ready to land.Sep 13 2023, 5:44 AM