imin imup | 1 Nov 2009 05:27
Picon

Re: Is there a way to disable exception in libtorrent?

Please excuse my long delay. I'm back to this task now.

When I tried to build libtorrent with BOOST_NO_EXCEPTIONS defined, compile
errors appear:

src/kademlia/dht_tracker.cpp: In member function ‘void
libtorrent::dht::dht_tracker::on_receive(const
boost::asio::ip::basic_endpoint<boost::asio::ip::udp>&, const char*, int)’:
src/kademlia/dht_tracker.cpp:523: error: passing ‘const libtorrent::entry’
as ‘this’ argument of ‘libtorrent::entry&
libtorrent::entry::operator[](const char*)’ discards qualifiers
...

I think the errors are caused by a throw in next lines,
524      if (id.size() != 20) throw std::runtime_error("invalid size of
id");

I'm using is libtorrent 0.14.1 and boost 1.36.0. Could you tell me
which version of libtorrent is ready to be built with exception disabled?

> then build libtorrent with the additional exception-handling=off argument.
>
>
This argument is not documented in
http://www.rasterbar.com/products/libtorrent/building.html.
Should I define the macro BOOST_NO_EXCEPTIONS instead or add
exception-handling=off  to bjam as you mentioned?
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
(Continue reading)

Alex Dedul | 1 Nov 2009 18:52
Picon
Gravatar

Questions about adding uTP support

Hi!

My intent is to add uTP to LT.. After some research i have some
questions related to how exactly that will be done and not only:

1. Is it better done as LT plugin or just it has to be implemented
right in the main LT codebase ?
2. After reading BEP-29 its not so clear now how LT should advertise
to peers what it supports uTP. Should it just try to connect by udp to
peer(in comparison to current usual method by tcp) and if that is
successful - uTP is supported and should be used - otherwise - use
usual tcp ?

With best regards from the Soul, Alex.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
Arvid Norberg | 2 Nov 2009 01:11
Picon
Picon
Favicon

Re: Questions about adding uTP support


On Nov 1,2009, at 9:52 , Alex Dedul wrote:

> Hi!
>
> My intent is to add uTP to LT.. After some research i have some
> questions related to how exactly that will be done and not only:
>
> 1. Is it better done as LT plugin or just it has to be implemented
> right in the main LT codebase ?

I think it'd be better as integrated in the core. I think the nicest  
way of
implementing it would be as an asio stream socket that takes a
datagram socket reference (or pointer) that it uses to send the actual
packets on. This way it could be integrated in the variant_socket type
and transparently switch out under the peer_connection.

I would suggest using the same udp socket as is used for the DHT.
The DHT udp socket is rate limited, so the uTP sockets would probably
need to reference the actual asio socket inside it, to circumvent the  
rate
limiter.

See the other socket types in there for reference (socks and i2p  
sockets).

> 2. After reading BEP-29 its not so clear now how LT should advertise
> to peers what it supports uTP. Should it just try to connect by udp to
> peer(in comparison to current usual method by tcp) and if that is
(Continue reading)

Arvid Norberg | 2 Nov 2009 04:24
Picon
Picon
Favicon

Re: Is there a way to disable exception in libtorrent?


On Oct 31,2009, at 21:27 , imin imup wrote:

> Please excuse my long delay. I'm back to this task now.
>
> When I tried to build libtorrent with BOOST_NO_EXCEPTIONS defined,  
> compile
> errors appear:
>
> src/kademlia/dht_tracker.cpp: In member function ‘void
> libtorrent::dht::dht_tracker::on_receive(const
> boost::asio::ip::basic_endpoint<boost::asio::ip::udp>&, const char*,  
> int)’:
> src/kademlia/dht_tracker.cpp:523: error: passing ‘const  
> libtorrent::entry’
> as ‘this’ argument of ‘libtorrent::entry&
> libtorrent::entry::operator[](const char*)’ discards qualifiers
> ...
>
> I think the errors are caused by a throw in next lines,
> 524      if (id.size() != 20) throw std::runtime_error("invalid size  
> of
> id");
>
> I'm using is libtorrent 0.14.1 and boost 1.36.0. Could you tell me
> which version of libtorrent is ready to be built with exception  
> disabled?

I really removed all dependencies on exceptions in 0.15. However, I  
just back-ported
(Continue reading)

Arvid Norberg | 2 Nov 2009 07:34
Picon
Picon
Favicon

Re: segfault on create_torrent

On Oct 28,2009, at 6:06 , lesion <at> autistici.org wrote:

> On 10/25/2009 10:07 PM, Arvid Norberg wrote:
>> On Oct 16,2009, at 15:39 , lesion <at> autistici.org wrote:
>>
>>> trying with trunk, branch RC_0_15, RC_0_14
>>>
>>> while using create_torrent from python binding:
>>>
>>> from libtorrent import  create_torrent, file_storage, add_files
>>> fs = file_storage()
>>> add_files( fs, '/some/dir/' )
>>> t = create_torrent( fs, 2**16 )
>>> Segmentation fault
>>>
>>>
>>> using "/some/dir" instead of "/some/dir/" as second arg of add_files
>>> the torrent is created correctly (without the slash)
>>
>>
>> Thanks for the report. I've fixed this in all three branches. Please
>> let me know if you still are seeing this problem.
>
> it does not segfault anymore but another issue appears:
> a torrent created for a directory with a slash at the end
> results invalid (only with same client),
> the only thing that changes from a torrent created from the same
> directory without the slash,it is the "name" property, in the second
> case is the directory name, the first one is an empty value.
> of course also the info_hash is different.
(Continue reading)

Alex Dedul | 2 Nov 2009 15:01
Picon
Gravatar

Re: Questions about adding uTP support

>> Hi!
>>
>> My intent is to add uTP to LT.. After some research i have some
>> questions related to how exactly that will be done and not only:
>>
>> 1. Is it better done as LT plugin or just it has to be implemented
>> right in the main LT codebase ?
>
> I think it'd be better as integrated in the core. I think the nicest
> way of
> implementing it would be as an asio stream socket that takes a
> datagram socket reference (or pointer) that it uses to send the actual
> packets on. This way it could be integrated in the variant_socket type
> and transparently switch out under the peer_connection.
>
> I would suggest using the same udp socket as is used for the DHT.
> The DHT udp socket is rate limited, so the uTP sockets would probably
> need to reference the actual asio socket inside it, to circumvent the
> rate
> limiter.
>
> See the other socket types in there for reference (socks and i2p
> sockets).

Seems like LT already has everything in place for adding uTP - so it
is just almost possible to be only focused on writing uTP
functionality itself, rather than changing lots of LT itself - this is
nice. :) Already redone basic template to use that proxy_base.

>> 2. After reading BEP-29 its not so clear now how LT should advertise
(Continue reading)

imin imup | 2 Nov 2009 17:42
Picon

Re: Is there a way to disable exception in libtorrent?

 Thanks a lot for helping.

> I really removed all dependencies on exceptions in 0.15. However, I just
> back-ported
> some changes to the 0.14 branch so that it can be built without exceptions
> as long as
> the DHT is not included. To build without exceptions with the DHT, you need
> at least 0.15.

Good work. Before 0.15 is released (No hurry at all, do you have a
schedule?), can 0.14.1 be built without exceptions if the DHT is not
included?

> BOOST_NO_EXCEPTIONS is automatically defined by boost.config when it
> detects that the compiler doesn't support exceptions (which is the case when
> you disable
> exception support). So, you're only supposed to have to disable the
> exceptions from
> the build command line for it to work.
>
>
Thanks for explanation. The cross-compiler I use doesn't complain about
try-throw-catch keyword. But it will crash in run-time if exception happens.
It "appears" it can support while it cannot do it correctly. So I'll have to
explicitly/manually disable it.

I use boost bjam to build. I add define=BOOST_NO_EXCEPTIONS to bjam command
line when I build boost and libotrrent. It seems working. Is this the way to
do it?
------------------------------------------------------------------------------
(Continue reading)

arvid | 2 Nov 2009 23:24
Picon
Picon
Favicon

Re: Is there a way to disable exception in libtorrent?

Quoting imin imup <iminimup <at> gmail.com>:

>  Thanks a lot for helping.
> 
> > I really removed all dependencies on exceptions in 0.15. However, I just
> > back-ported
> > some changes to the 0.14 branch so that it can be built without exceptions
> > as long as
> > the DHT is not included. To build without exceptions with the DHT, you
> need
> > at least 0.15.
> 
> 
> Good work. Before 0.15 is released (No hurry at all, do you have a
> schedule?), can 0.14.1 be built without exceptions if the DHT is not
> included?
> 
> 
> 
> 
> > BOOST_NO_EXCEPTIONS is automatically defined by boost.config when it
> > detects that the compiler doesn't support exceptions (which is the case
> when
> > you disable
> > exception support). So, you're only supposed to have to disable the
> > exceptions from
> > the build command line for it to work.
> >
> >
> Thanks for explanation. The cross-compiler I use doesn't complain about
(Continue reading)

imin imup | 3 Nov 2009 04:36
Picon

Re: Is there a way to disable exception in libtorrent?

>
> >
> > > I really removed all dependencies on exceptions in 0.15. However, I
> just
> > > back-ported
> > > some changes to the 0.14 branch so that it can be built without
> exceptions
> > > as long as
> > > the DHT is not included. To build without exceptions with the DHT, you
> > need
> > > at least 0.15.
>

Here is the result I tried on 0.14.1. After the dht_support is off, I can
build more until the following error appears:

../include/libtorrent/variant_stream.hpp:333: error: no matching function
for call to ‘libtorrent::socks5_stream::local_endpoint() const’
../include/libtorrent/proxy_base.hpp:180: note: candidates are:
boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>
libtorrent::proxy_base::local_endpoint(boost::system::error_code&) const

I'm not sure if I did something wrong on 0.14.1 or I'm using the wrong
version. Could you please point me to a sub-branch of 0.14 which can be
build without exception handling if DHT is turned off?
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
(Continue reading)

Alex Dedul | 3 Nov 2009 14:25
Picon
Gravatar

Re: Questions about adding uTP support

On Mon, Nov 2, 2009 at 2:11 AM, Arvid Norberg <arvid <at> cs.umu.se> wrote:
>
> On Nov 1,2009, at 9:52 , Alex Dedul wrote:
>
>> Hi!
>>
>> My intent is to add uTP to LT.. After some research i have some
>> questions related to how exactly that will be done and not only:
>>
>> 1. Is it better done as LT plugin or just it has to be implemented
>> right in the main LT codebase ?
>
[...]
>
> I would suggest using the same udp socket as is used for the DHT.
> The DHT udp socket is rate limited, so the uTP sockets would probably
> need to reference the actual asio socket inside it, to circumvent the
> rate
> limiter.

I have a questing related to this - isn't udp_socket class is not
limited and its should be used plain as it is while DHT uses
rate_limited_udp_socket where that maybe referencing to the actual
asio socket is needed ?

With best regards from the Soul, Alex.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
(Continue reading)


Gmane