Re: DHT specification questions

[email protected] Wed, 13 Aug 2008 21:30:37 +0000 (UTC)
Newsgroups gmane.network.gnutella.devel
Organization Home, Grenoble, France
Message-ID <[email protected]>
FYI, here are the defined error codes for STORE operations used in gtk-gnutella.
The error code 2 is NOT used by gtk-gnutella, nor is gtk-gnutella sending
textual description along with error codes:

/**
 * Store status codes.
 */
#define STORE_SC_OK             1U  /**< OK */
#define STORE_SC_ERROR          2U  /**< Generic error */
#define STORE_SC_FULL           3U  /**< Node is full for this key */
#define STORE_SC_LOADED         4U  /**< Node is too loaded for this key */
#define STORE_SC_FULL_LOADED    5U  /**< Node is both loaded and full */
#define STORE_SC_TOO_LARGE      6U  /**< Value is too large */
#define STORE_SC_EXHAUSTED      7U  /**< Storage space exhausted */
#define STORE_SC_BAD_CREATOR    8U  /**< Creator is not acceptable */
#define STORE_SC_BAD_VALUE      9U  /**< Analyzed value did not validate */
#define STORE_SC_BAD_TYPE       10U /**< Improper value type */
#define STORE_SC_QUOTA          11U /**< Storage quota for creator reached */
#define STORE_SC_DATA_MISMATCH  12U /**< Republished data is different */
#define STORE_SC_BAD_TOKEN      13U /**< Invalid security token */

Little comments:

Security tokens in gtk-gnutella expire after 2 hours.  When a STORE comes
with an invalid security token, gtk-gnutella normally drops the request
without answering BUT when the request comes from one of the k-closest nodes,
in which case a STORE_ACK is sent for the first supplied DHT value with
a status of STORE_SC_BAD_TOKEN.

STORE_SC_BAD_CREATOR is used when the creator's address is unusable (private
range, bogus, etc...).

STORE_SC_BAD_TYPE is used when the STORE request comes with an "ANY" type.

STORE_SC_FULL means there are already enough creators for the key (current
limit is 16 per key).

STORE_SC_LOADED means there are more than 5 requests/minute on average
for the key. STORE_SC_FULL_LOADED is used when the node is both full and
loaded for the key.

STORE_SC_TOO_LARGE is used when the value payload is larger than 512 bytes.

STORE_SC_QUOTA is used when the amount of values for the creator's IP address
or network is too large.

STORE_SC_DATA_MISMATCH is returned when a replication is not sending the
exact same payload as the data currently held locally for the key and for
this creator.

STORE_SC_EXHAUSTED naturally means that the storage resources for values
has reached the limit.  When all the k-closest node start returning this,
it means the keyspace is under heavy usage...

Final comments:

The message format of STORE_ACK (aka STORE_RESPONSE) is way too verbose.
Why re-iterate the key and all the creators for all the values?  A single
vector of status codes would have been just fine.  I chose to comply with
the specifications for now, but this particular message format should
evolve quickly because it is just too verbose.

I like the ability to specify more than one DHT value in a single STORE
message.  This is handy for replicating keys to neighbours as it limits
the amount of overhead.

Raphael