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

clean the unused p2p sockets (i.e. not in peers list) #2298

Merged
merged 2 commits into from
Jan 7, 2019
Merged

clean the unused p2p sockets (i.e. not in peers list) #2298

merged 2 commits into from
Jan 7, 2019

Conversation

garyyu
Copy link
Contributor

@garyyu garyyu commented Jan 6, 2019

Draw half of #2287 to here:

When a connected socket is not in our active peers list, it becomes a lost peer and we never have chance to use it for sending, and it brings us a security risk that we connected an "invisible" peer (or peers), this "invisible" peer still can send us something!

This PR will kill this risk.

@@ -191,6 +201,25 @@ impl Server {
false
}

fn clean_lost_sockets(&self, sockets: &mut HashMap<SocketAddr, TcpStream>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps add a code comment here outlining the NAT issue and why this direct connection tracking and cleanup is necessary? This way we won't forget why this is required right now, and what sort of improvements will be needed to make this unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, added.

@garyyu
Copy link
Contributor Author

garyyu commented Jan 7, 2019

If no more comments on this PR, i will merge it soon, since I'm still suffering on that full connections problem :)

@garyyu garyyu merged commit e79123f into mimblewimble:master Jan 7, 2019
@garyyu garyyu deleted the sockets-clean branch January 7, 2019 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants