libtorrent blog

bittorrent development from the trenches

evolving the torrent_info API

Currently, torrent files are loaded by the torrent_info constructor. The torrent_info object essentially holds all state from the .torrent file.This post is arguing in favor of moving towards torrent_info only representing the immutable portion of torrent files. i.e. what’s in the info-section. This is primarily motivated by the v2 piece-layers that are currently part of . . .

BitTorrent v2

libtorrent-2.0 has just been released with a few major new features. One of them is support for BitTorrent v2. Most of the specification work of BEP 52 was done by the8472. The libtorrent support for bittorrent v2 was mostly implemented by Steven Siloti. BiglyBT also has an implementation of BitTorrent v2 to be released in . . .

forward declarations and ABI

This post argues the C++ rule: One should never forward declare a name from a 3rd party library This rule is a generalisation of the same rule for the standard library. The standard says [namespace.std]: The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within . . .

building libtorrent for C.H.I.P.™

I recently bought a C.H.I.P. and naturally wanted to build libtorrent for it. I’m on a mac and chip runs arm, so first I needed to install the cross compiler toolchain. The target for chip is arm on linux, so the toolchain I’m looking for is “arm-linux-gnueabihf”. toolchain It seems like a fair number of people . . .

link compatibility

A major source of errors among users of libtorrent has traditionally been caused by binary incompatibility between the (built) libtorrent library and the client linking against it. Binary- or link compatibility is having two sides of a shared library (or translation unit) boundary have different understandings about the layout of objects or calling conventions. Consider the following library interface: . . .

DHT bootstrap node

With the release of libtorrent-1.1.1, libtorrent finally got its very own default DHT bootstrap node, dht.libtorrent.org:25401. This post gives some background on the work that went into setting it up.

unsigned integers

In this post I will talk about the use of unsigned (integral) types in C++, or perhaps more specifically the rationale for using them. In my experience, it is common to use unsigned types for any variable holding a value that cannot be negative. Say, the number of bytes in a buffer.

slow start

This post is a result of looking into a slow-start performance issue in uTP. Slow-start is a mechanism in TCP employed to discover the capacity of a link, before transitioning into the steady state regime of additive increase and multiplicative decrease. Slow start is employed on new connections and after time-outs (where the congestion window . . .

libtorrent alert queue

The main mechanism libtorrent uses to report events and errors to the client is via alerts. Alerts are messages as c++ objects with additional information depending on the type of message. Periodically clients poll for new alerts from a session object. In the next major release of libtorrent detailed peer logging will be available as . . .

bdecode parsers

I have recently revisited the bdecoder in libtorrent, and ended up implementing a new bdecoder that is two orders of magnitude faster than the original (naive) parser. This is the 3rd decoder in libtorrent’s history, and I would like to cover its evolution of parsing bencoded data.