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 compression enable flag and compression algorithm fetching #3705

Closed
wants to merge 1 commit into from

Conversation

gregtatcam
Copy link
Collaborator

High Level Overview of Change

Fixes compressionEnabled_ flag in the inbound peer.
Fixes compression algorithm fetching on protocol message receive.

Context of Change

Both issues are introduced in 1.6.0.

First fix adds configuration compression flag check when setting compressionEnabled_ in the PeerImp constructor.
Previously the compressionEnabled_ of the inbound peer was set to true if the connected peer supported compression even though the node didn't support the compression.

Second fix adds 0xF0 mask when fetching the compression algorithm from a received message. Previously the compression algorithm used the whole byte. Since the algorithm occupies high four bits, when a payload size is large then the low four bits could be set resulting in an invalid algorithm.

Type of Change

Test Plan

Added log messages to PeerImp::PeerImp() to verify the compressionEnabled_ flag for different compression configurations. Added log messages to PeerImp::onMessageBegin() to output received message compressed flag and peer's remote address.

Fix compression algorithm fetching in protocol message
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.

Compression handshake is not handled correctly (Version: 1.7.0-b2)
2 participants