Skip to content

Conversation

@rjarry
Copy link
Contributor

@rjarry rjarry commented Oct 5, 2020

When the message header is not a multiple of 8 bytes long, there will be an additional read performed when reading the body since there is an alignment after reading the header. I forgot to take this into account in #62.

I also added a small optimization in padding computing since I needed a separate function to get header padding.

rjarry added 2 commits October 5, 2020 09:50
Avoid using the slow MOD (%) operator. Use bitvise AND (&) instead.

Signed-off-by: Robin Jarry <[email protected]>
When the message header is not a multiple of 8 bytes long, the alignment
bytes will not be prefetched and an additional read() system call will
be made when reading the end of the body.

Add the padding bytes to the prefetch length.

Fixes: 7efeef4 ("unmarshaller: reduce number of read system calls")
Signed-off-by: Robin Jarry <[email protected]>
@acrisci
Copy link
Member

acrisci commented Oct 6, 2020

👍

@acrisci acrisci merged commit 2b6bb81 into altdesktop:master Oct 6, 2020
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