Page MenuHomePhabricator

[tunnelbroker] Make WebSocketSession generic
ClosedPublic

Authored by bartek on Sep 12 2023, 1:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 20, 5:10 PM
Unknown Object (File)
Wed, Nov 20, 5:10 PM
Unknown Object (File)
Wed, Nov 20, 5:10 PM
Unknown Object (File)
Wed, Nov 20, 5:08 PM
Unknown Object (File)
Mon, Nov 11, 7:07 PM
Unknown Object (File)
Fri, Nov 8, 7:06 PM
Unknown Object (File)
Thu, Nov 7, 7:34 AM
Unknown Object (File)
Tue, Nov 5, 8:29 AM
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