in reply to Limiting bandwidth
For a very quick fix to avoid upsetting your generous benefactor, you could simply add a select delay into the while loop in /lib/Net/FTp.pm (~ line 488). I'd put it just before the line (~490)
select undef, undef, undef, 0.005; ## Adjust. > slower; < faster. last unless $len = $data->read($buf,$blksize);
You can then adjust the value manually to strike a balance between your needs and theirs.
Adding a more formal parameter that allowed the rate to be specified in terms of kb/second wouln't be too hard to do for your system using a little math and some fudge factor.
Making that generic enough to offer it as a patch would be considerably harder as you would have to incorporate some means of self calibration across systems with different performance. And once it became a part of the standard interface, woe betide the author if it only achieved 1.9kb/sec when requested for 2kb/sec.
|
|---|