y500 / libtorrent

Automatically exported from code.google.com/p/libtorrent
0 stars 0 forks source link

Speed greater than limit #673

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,
I'm tring to use libtorrent library and I have a some following problem.

I create torrents with default settings and set them limits (e.g., 100Kb) as
  torrent_handle.set_download_limit(limit);

And when I ask speed for the current torrent:
  torrent_handle.status ().upload_payload_rate
sometimes I get greater value then the limit (e.g., 200Kb or 300Kb).

What's wrong? Why my torrent limits aren't applyed?

Original issue reported on code.google.com by schi...@vicman.net on 10 Sep 2014 at 11:11

GoogleCodeExporter commented 8 years ago
you set the download limit and look at your upload rate. set_download_limit() 
won't (directly) affect your upload rate.

Original comment by ar...@bittorrent.com on 10 Sep 2014 at 8:32

GoogleCodeExporter commented 8 years ago

Original comment by arvid.no...@gmail.com on 10 Sep 2014 at 8:33

GoogleCodeExporter commented 8 years ago
I'm sorry. Wrong example. I mean download_payload_rate

Original comment by schi...@vicman.net on 11 Sep 2014 at 6:54

GoogleCodeExporter commented 8 years ago
what is the average download rate you see? the rate limit allows some slack. 
iirc, it allows bursts of up to 3 seconds worth of bandwidth (i.e. if you have 
a spike 3 times your rate every 3 seconds, and 0 download rate in between, that 
still counts as rate limited)

Original comment by arvid.no...@gmail.com on 11 Sep 2014 at 7:03

GoogleCodeExporter commented 8 years ago
I see download rate as I've described above (rate can jump up to 200 and even 
300Kb for 100Kb limit). But there is one thing I figured out... I refresh UI 
every 1 sec. Maybe I should do it less often (as you say every 3 sec.).

Original comment by schi...@vicman.net on 11 Sep 2014 at 8:17

GoogleCodeExporter commented 8 years ago
the rate reported by libtorrent doesn't depend on how often you ask it 
unfortunately. If you want to average the rate, instead you can ask for the 
total downloaded bytes, remember that between asking. When you ask the next 
time, just subtract the previous reading and divide by the time interval.

Original comment by arvid.no...@gmail.com on 11 Sep 2014 at 5:26