DC++ software clients - ShakesPeer

tagged , , , and

ShakesPeer is a p2p, or peer to peer file sharing program. It is a client for the Direct Connect protocol. The main goal of ShakesPeer is to create a fully featured client, compatible with DC++, that runs on Mac OS X with a native Aqua GUI. The program is released as Open Source under the GPL License.

Design Overview of ShakesPeer

Processes and inter-process communication /

The ShakesPeer program is not really one program, but three. Those are sphubd, sphashd and the UI (user interface). Those three parts are run as separate processes. Inter-process communication between those thre programs is achieved by using sockets. By default, unix sockets are used, which are local. Using unix sockets, all programs must be running on the same computer. Replacing the unix socket with a TCP socket enables the programs to run on different machines. In fact, sphubd already has that option when communcating with the UI.
Portability /

The core servers (sphubd and sphashd) are written in C. (Actually C99 with GCC extensions, so GCC is required for compilation.) Otherwise they should be quite portable across Unix-like operating systems. At least Darwin (Mac OS X), Linux and OpenBSD are supported and actively tested. GNU make is required for building.

There are currently two user interfaces: one command line client and the graphical user interface for Mac OS X. The command line client should be portable, but the OS X GUI requires Mac OS X. Creating different user interfaces for different platforms and/or GUI toolkits is made easier by having most of the functionality in the core servers.
sphubd /

The sphubd process is responsible for hub communication, peer communication (uploads/downloads), handling the download queue and shared files, listening for search results and communicating events to the UI.

Persistence of the download queue and file hashes (TTHs) is achieved with Berkeley DB.

No threads are used. This is a very important design choice, and is what separates ShakesPeer from most other DC implementations. IMHO, threads are evil. To achieve concurrency, libevent is used to implement an event driven program.
sphashd/

The sphashd process is responsible for hashing files. The reason this is a separate process from sphubd is to be able to decrease the priority level (”nice” value). Since hashing is a CPU intensive and quite lengthy task, reducing the priority of the sphashd process enables the user to actually use the computer for other tasks. Note that if no other programs use the CPU, sphashd will still use near 100% CPU, but will “step aside” as soon as another process is running.

A brief tour of how ShakesPeer’s source code repository is organized

splib/

Includes functions common to both server and client, or is just more general purpose and reusable.
sphubd/

The hub daemon and the hashing daemon.
spclient/

Code usable by clients (i.e. both CLI and GUI), for example hub- and filelist parsing. Also includes some code dealing with client-server communication. In spclient/spclient.c are functions for connecting to the sphubd socket (using code in splib/io.c).
support/

Former autoconf and M4 support files, now assorted scripts. Here are awk scripts that generate the actual code that sends and dispatches commands between client and server.

gen_cmd_source.awk and gen_cmd_header.awk generates source for dispatching read commands from the socket. Input files are sphubd/ui_cmd.in and spclient/spclient_cmd.in. The former defines commands that UI:s can send to sphubd while the latter defines commands that sphubd can send to UI:s.

It’s important to remember that all those commands actually are notifications, since no return value is handled.

The gen_send_*.awk scripts generates the corresponding functions that send commands.

The syntax of the .in files are a bit obscure. I actually don’t remember it exactly. (hmm, that’s what you get for being terse…)
gui/Aqua /

The Mac OS X front-end, as an Xcode-project.





Trimite pe Y!Mess/Send on Y!Mess


ShakesPeer client software download
DC++ software clients - BCDC++
DC++ software clients - mDC++
DC++ software clients - IceDC++
DC++ software clients - RevConnect

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)