Changeset 12408


Ignore:
Timestamp:
Apr 30, 2011, 11:03:25 PM (10 years ago)
Author:
jch
Message:

Include dht-0.19.

This fixes a bug with parsing of announce messages, noticed by cjdelisle.

Location:
trunk/third-party/dht
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/third-party/dht/CHANGES

    r11727 r12408  
     130 April 2011: dht-0.19
     2
     3  * Fix incorrect parsing of announces.  Thanks to cjdelisle.
     4  * Relax rate limiting slightly.
     5
    1620 January 2011: dht-0.18
    27
  • trunk/third-party/dht/dht.c

    r11895 r12408  
    311311static time_t expire_stuff_time;
    312312
    313 #define MAX_TOKEN_BUCKET_TOKENS 40
     313#define MAX_TOKEN_BUCKET_TOKENS 400
    314314static time_t token_bucket_time;
    315315static int token_bucket_tokens;
     
    12221222
    12231223static int
    1224 storage_store(const unsigned char *id, const struct sockaddr *sa)
     1224storage_store(const unsigned char *id,
     1225              const struct sockaddr *sa, unsigned short port)
    12251226{
    12261227    int i, len;
    12271228    struct storage *st;
    12281229    unsigned char *ip;
    1229     unsigned short port;
    12301230
    12311231    if(sa->sa_family == AF_INET) {
     
    12331233        ip = (unsigned char*)&sin->sin_addr;
    12341234        len = 4;
    1235         port = ntohs(sin->sin_port);
    12361235    } else if(sa->sa_family == AF_INET6) {
    12371236        struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)sa;
    12381237        ip = (unsigned char*)&sin6->sin6_addr;
    12391238        len = 16;
    1240         port = ntohs(sin6->sin6_port);
    12411239    } else {
    12421240        return -1;
     
    17151713    if(token_bucket_tokens == 0) {
    17161714        token_bucket_tokens = MIN(MAX_TOKEN_BUCKET_TOKENS,
    1717                                   4 * (now.tv_sec - token_bucket_time));
     1715                                  100 * (now.tv_sec - token_bucket_time));
    17181716        token_bucket_time = now.tv_sec;
    17191717    }
     
    20902088                break;
    20912089            }
    2092             storage_store(info_hash, from);
     2090            storage_store(info_hash, from, port);
    20932091            /* Note that if storage_store failed, we lie to the requestor.
    20942092               This is to prevent them from backtracking, and hence
Note: See TracChangeset for help on using the changeset viewer.