P2PResearch

whats happening in the peersphere

Unworkable: A Free BitTorrent Implementation

Unworkable is a BSD-licensed BitTorrent implementation written by Niall O'Higgins <niallo@p2presearch.com>.
Goals of this project include efficiency, simplicity and high code quality.

Unworkable is single threaded and asynchronous, written in portable ANSI C using libevent and mmap() for performance.
Unworkable is developed primarily under OpenBSD, however it has been written with portability in mind and should compile and run out of the box on at least:

  • Various Linux flavours:
    • Arch Linux
    • Centos 5
    • Fedora 7 (Amazon EC 2)
    • Gentoo Linux
    • Ubuntu Linux 7.10 and up
    • Mandriva Linux 2008.1
  • FreeBSD 6.2
  • Mac OS X (both PPC and i386)
  • Solaris 10
  • Windows XP (cygwin)

I go out of my way to use slower, harsher platforms for development (e.g. old sparc64, g3 macppc, arm zaurus) to weed out endianness and pointer issues, and of course to get a feel for performance problems. This approach has led to quite reasonable CPU and memory requirements. Transferring at around 150KB/sec used 5% CPU and 1.4M memory on a 270Mhz UltraSparc II machine. Given that contemporary machines are roughly an order of magnitude faster than this, performance should be within acceptable bounds.

Screen shots

Windows XP via Cygwin: Unworkable on Windows XP

Large photo of unworkable running on a Sharp Zaurus PDA.

Latest updates

2008-10-01: Unworkable 0.51 released.

2008-09-21: Unworkable 0.5 released.

2008-01-07: Unworkable 0.4 released.

2007-12-20: Unworkable 0.3 released.

2007-12-05: Unworkable 0.2 released.

Most recent three CVS commits:

includes.h
revision 1.62
date: 2008/11/04 21:12:20;  author: niallo;  state: Exp;  lines: +2 -2
move sys/resources include

bencode.c
revision 1.41
date: 2008/10/21 19:01:15;  author: niallo;  state: Exp;  lines: +3 -3
%zu is correct format specifier for size_t

torrent.c
revision 1.108
date: 2008/10/06 18:47:11;  author: niallo;  state: Exp;  lines: +3 -1
check for zero infoend.
should help with bad torrent files.
prodded by Timo Juhani Lindfors


Features

Unworkable is in the early stages of development and is missing many important features.
However, it has been used for some real-world torrent downloads with success.
Patches are welcome.

Unworkable currently lacks support for the following:

  • HTTP/1.1 client. Many trackers do not correctly support HTTP/1.0 so downloads will not work.
  • Encryption.
  • Trackerless (DHT) operation.
  • Probably lots of other stuff.
Do not be too surprised if you encounter a bug - but please report any issues you find.

Binary packages

Arch Linux
CVS build contributed by Tom K. Thanks Tom!

OpenBSD
As of this commit on 2007-11-26, Unworkable is available in the OpenBSD ports repository as 'net/unworkable'. Starting with the next packages snapshot, users should simply be able to type 'pkg_add unworkable' on their OpenBSD system and have Unworkable installed.

Other Platforms
I have not gotten around to making binary packages for any other platforms yet. Contributions welcome.

Building

Unworkable will build cleanly on OpenBSD (tested on i386, amd64, zaurus, sparc64, macppc) without any additional dependencies beyond the base install. Simply type 'make'.

On other platforms, you must use the SCons build tool. After installing scons, type 'scons' to compile. Make sure you have libevent, OpenSSL and some YACC implementation (e.g. BSD yacc(1) or GNU bison) installed. If you get it working on other platforms, please let me know and send along any portability diffs.

Usage

Unworkable is supposed to be simple to use.

$ ./unworkable mymusic.torrent
mymusic.torrent                          hash ok:  35% rx: 9538KB 103.0KB/s   02:38 ETA
A manual page is included in the source, and built by default under OpenBSD.

Getting the Source

Latest source can be aquired via anoncvs from the host cvs.unworkable.org. I try to keep the HEAD as 'the best possible version' and strive to fix any checked-in breakage quickly.

$ export CVS_RSH=ssh
$ cvs -d anoncvs@cvs.unworkable.org:/cvs co unworkable

A tarball of version 0.51 is available at http://p2presearch.com/unworkable/dist/unworkable-0.51.tar.gz.

$Id: index.shtml,v 1.7 2008/10/02 03:37:00 niallo Exp $