Add a limit_bandwidth parameter to get and put function. #75
Open
pletessier wants to merge 4 commits intojbardin:masterfrom
Open
Add a limit_bandwidth parameter to get and put function. #75pletessier wants to merge 4 commits intojbardin:masterfrom
pletessier wants to merge 4 commits intojbardin:masterfrom
Conversation
added 3 commits
July 26, 2016 14:51
…has to be increased to handle pauses happening at start. The more the bandwidth is limited, the more the timeout should be.
…has to be increased to handle pauses happening at start. The more the bandwidth is limited, the more the timeout should be.
…mit-parameter # Conflicts: # scp.py
Owner
|
The |
Author
|
Yes it works. I've tested it with several different bandwidth, and iftop always confirm the values. But you're right, it's not sent to the sink. In fact, I think scp tries to download the first packets, evaluate the rate, and then wait between every packets to not go over the given limit. So the first seconds are very chaotic, and after the bandwith stabilizes. You won't see it on small files. |
scp.py
Outdated
| scp_command = (b'scp -t ', b'scp -r -t ')[recursive] | ||
| scp_command = b'scp -t ' | ||
| scp_command += (b'', b' -r ')[recursive] | ||
| scp_command += (b'', b' -l '+ str(limit_bandwidth).encode() + b' ')[limit_bandwidth > 0] |
Collaborator
There was a problem hiding this comment.
Can't we use a proper if here?
if limit_bandwidth > 0:
scp_command += b' -l ' + str(limit_bandwidth).encode() + b' '
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The timeout has to be increased to handle pauses happening at start. The more the bandwidth is limited, the more the timeout should be.