Skip to content
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

Avoid calling socket.peer_addr() #497

Merged
merged 1 commit into from
Nov 11, 2020
Merged

Avoid calling socket.peer_addr() #497

merged 1 commit into from
Nov 11, 2020

Conversation

msrd0
Copy link
Member

@msrd0 msrd0 commented Nov 6, 2020

Tokio's documentation says that calling .accept() in a loop is equivalent to using .incoming(), but it has the advantage of handing us the peer address together with the socket so we don't need to call .peer_addr() on the returned socket. Also, .incoming() has been removed in tokio 0.3.

Fixes #461

@codecov
Copy link

codecov bot commented Nov 6, 2020

Codecov Report

Merging #497 into master will decrease coverage by 0.02%.
The diff coverage is 82.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #497      +/-   ##
==========================================
- Coverage   84.90%   84.88%   -0.03%     
==========================================
  Files         109      109              
  Lines        5599     5596       -3     
==========================================
- Hits         4754     4750       -4     
- Misses        845      846       +1     
Impacted Files Coverage Δ
gotham/src/lib.rs 80.00% <82.35%> (-2.15%) ⬇️
gotham/src/middleware/session/backend/memory.rs 89.89% <0.00%> (-1.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5fcf5b1...c09b9a3. Read the comment docs.

Copy link
Contributor

@nyarly nyarly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. It reminds me that we'd like to handle protocol errors better, though.

@msrd0 msrd0 merged commit 5ac2e3c into gotham-rs:master Nov 11, 2020
@msrd0 msrd0 deleted the issue-461 branch November 11, 2020 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transport endpoint is not connected, peer_addr() unwrap panics
3 participants