Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
websockets and upgrade mechanism #2466
websockets and upgrade mechanism #2466
Changes from 1 commit
d032926
ab12eaf
6b9cc12
d35c588
0039a11
e4832e3
834fd45
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I don't think it's necessary to pin the async block here.
This also makes a double allocation.
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.
It's needed since the
rokio::join!
for thestart()
method ofimpl Upgrade for Websocket
requiresUnpin
, and it seems that only a innerBox::pin
solves the issue; atleast thats also what rust itself suggests.https://github.com/Mai-Lapyst/Rocket/blob/6b9cc12c40683ebe3286046893af9fd0a3cbfac0/core/lib/src/response/websocket/mod.rs#L266
Compiler error
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.
My bad, I didn't know async blocks are
!Unpin
.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.
Don't know if it will work, but what if you use
Box::into_pin(event_loop)
ortokio::pin!(event_loop)
before usingtokio::join!
?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.
Using
Box::into_pin
it's working; added a commit.