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

fix: connection close should stay outside the poll loop #2308

Merged
merged 1 commit into from
Jan 7, 2019
Merged

fix: connection close should stay outside the poll loop #2308

merged 1 commit into from
Jan 7, 2019

Conversation

garyyu
Copy link
Contributor

@garyyu garyyu commented Jan 7, 2019

Really don't like the macro! I just realize that try_break macro will break the poll loop, that means in case of error, we send error message to error_tx, and rely on peer::check_connection to get this error and then call stop_with_connection, and then send a message in close_channel, but at this time, unfortunately the close_channel (i.e. close_rx in conn::poll) will never be read, because poll thread already exit!

So, let's move that conn.shutdown to the outside of poll loop, to make sure an error connection is cleaned.

Another modification in this PR for peer is a small improvement to not cache the duplicated hash (for received header/block/compact_block/tx) from a peer.

@garyyu garyyu merged commit 0b73e87 into mimblewimble:master Jan 7, 2019
@garyyu garyyu deleted the shutdown 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.

None yet

1 participant