What is the necessity of error messages in the unreliable RPC protocol that BitTorrent Mainline DHT uses?

StackOverflow https://stackoverflow.com/questions/12108107

Question

Mainline DHT is the DHT used by BitTorrent, which implements an RPC protocol over UDP called KRPC. KRPC includes support for error messages outlined here.

Why is this necessary? As this is an unreliable protocol, there is no guarantee of these messages being received, as well as the fact that there is no apparent use to them.

Was it helpful?

Solution

If you send malformed messages to a node, it may be helpful for that node to return an error message so that you can fix your code, instead of pretending the message wasn't received.

If every node would respond with error messages, client developers would have a much easier time fixing bugs in their DHT implementations.

As far as I know, only libtorrent (rasterbar) and the original BitTorrent Mainline (python version) send error codes in the DHT. It's possible other clients do, but primarily, uTorrent doesn't.

Update:

The error codes were extended in the put/get extension to be used for atomic writes. When updating a slot in the DHT, an error message may inform the writer that the slot was updated in between reading-updating-writing it, and that it should try again. This is referred to as CAS in the specification (named after the CPU operations compare-and-swap).

This extension is supported by uTorrent, libtorrent and Bleep.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top