This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SVN 544444] KTorrent don't set TOS

Tags: None
(comma "," separated)
Moshroum
Registered Member
Posts
63
Karma
0

[SVN 544444] KTorrent don't set TOS

Wed May 24, 2006 6:37 pm
As I noticed, KTorrent doesn't set any TOS option, so the gateway before my system doesnt get any infos about type of data and will not shape the traffic as expected. There was a thread some time ago about bittorrent setting the wrong tos.

I would expect that ktorrent needs to set IP_TOS to IPTOS_THROUGHPUT as bittorrent does it since 4.1 or so for connections (see BitTorrent-4.4.0/BitTorrent/RawServer.py line 231, 246, 285 - the calling functions will give 8 "IPTOS_THROUGHPUT" as parameter tos. See BitTorrent-4.4.0/BitTorrent/defaultargs.py line 135 peer_socket_tos).

And for IPv6 stuff....TCLASS looks something like IP_TOS for IPv6

Since I am not very familiar with the ktorrent source code, just a quick hack:

Code: Select all
--- libktorrent/mse/streamsocket.cpp.orig   2006-05-25 09:23:06.000000000 +0200
+++ libktorrent/mse/streamsocket.cpp   2006-05-25 09:24:09.000000000 +0200
@@ -142,6 +142,8 @@
    void StreamSocket::connectTo(const QString & ip,Uint16 port)
    {
       sock->connectToHost(ip,port);
+      const int tos = 0x8;
+      setsockopt(sock->socketDevice()->socket(),IPPROTO_IP,IP_TOS,(char*)&tos,sizeof(int));
    }
       
    void StreamSocket::initCrypt(const bt::SHA1Hash & dkey,const bt::SHA1Hash & ekey)
George
Moderator
Posts
5421
Karma
1

Thu May 25, 2006 10:47 am
You are right we should be setting that.

I have added it to the current SVN version.
Moshroum
Registered Member
Posts
63
Karma
0

Thu May 25, 2006 11:45 am
Looks good, thx


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]