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

Allow configuration of a data size before a flush occurs #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

BadPractice
Copy link

Currently the client gets flushed every command (which is every pixel) this is inefficient since every tcp package can hold multiple pixel (the exact number depends on the network and mtu).

This patch gives 3 options for setting a FlushMode:
- Manual > Never flush
- Commands > Flush after a number of commands (like Pixels)
- Bytes > Flush when a package size is reached.

Philipp Hufnagl added 2 commits January 6, 2024 23:06
Currently the client gets flushed every command (which is every pixel)
this is inefficient since every tcp package can hold multiple pixel (the
exact number depends on the network and mtu).

This patch gives 3 options for setting a FlushMode:
- Manual > Never flush
- Commands > Flush after a number of commands (like Pixels)
- Bytes > Flush when a package size is reached.

Further a flush_size has to be set. Example:

To run in the current mode where a flush occurs per pixel:
- FlushMode::Command,1

To flush at a size of 1500 Bytes (which is a commonly used mtu):
- FlushMode:Bytes,1

Further a method is introduced for the client to flush manually
This exposes the previously introduced Flush Mode to the List of
configurable arguments. If no argument is confiured here, there will a
flush occur every command/pixel as was the case before.

Examples:

Flush every single Pixel as it is the default:
pixelpwnr '<socket>' --image=cat.png  -w 500 -h 500 -x 0 -y 0 --flushmode commands --flushsize 1

Flush after 1500 bytes (commonly used mtu)
pixelpwnr '<socket>' --image=cat.png  -w 500 -h 500 -x 0 -y 0 --flushmode bytes --flushsize 1500
Copy link
Owner

@timvisee timvisee left a comment

Choose a reason for hiding this comment

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

Thanks for this addition!

Please see my review comment below:

src/pix/client.rs Outdated Show resolved Hide resolved
Co-authored-by: Tim Visée <tim+github@visee.me>
@BadPractice
Copy link
Author

sry it took my so long
done

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