Changeset 11663


Ignore:
Timestamp:
Jan 9, 2011, 11:44:59 PM (11 years ago)
Author:
jch
Message:

Import dht-0.17.

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

Legend:

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

    r11655 r11663  
     19 January 2011: dht-0.17:
     2
     3  * Fix a bug that prevented calling dht_init after dht_uninit.
     4  * Remove the "dofree" parameter to dht_uninit.
     5
    1623 December 2010: dht-0.16:
    27
  • trunk/third-party/dht/README

    r11655 r11663  
    3535* dht_uninit
    3636
    37 This may be called at the end of the session.  If dofree is true, it frees
    38 all the memory allocated for the DHT.  If dofree is false, this function
    39 currently does nothing.
     37This may be called at the end of the session.
    4038
    4139Bootstrapping
  • trunk/third-party/dht/dht-example.c

    r11655 r11663  
    401401    }
    402402
    403     dht_uninit(1);
     403    dht_uninit();
    404404    return 0;
    405405   
  • trunk/third-party/dht/dht.c

    r11655 r11663  
    11/*
    2 Copyright (c) 2009, 2010 by Juliusz Chroboczek
     2Copyright (c) 2009-2011 by Juliusz Chroboczek
    33
    44Permission is hereby granted, free of charge, to any person obtaining a copy
     
    16601660
    16611661int
    1662 dht_uninit(int dofree)
    1663 {
    1664     if(dht_socket < 0) {
     1662dht_uninit()
     1663{
     1664    if(dht_socket < 0 && dht_socket6 < 0) {
    16651665        errno = EINVAL;
    16661666        return -1;
    16671667    }
    16681668
    1669     if(!dofree)
    1670         return 1;
     1669    dht_socket = -1;
     1670    dht_socket6 = -1;
    16711671
    16721672    while(buckets) {
    16731673        struct bucket *b = buckets;
    16741674        buckets = b->next;
     1675        while(b->nodes) {
     1676            struct node *n = b->nodes;
     1677            b->nodes = n->next;
     1678            free(n);
     1679        }
     1680        free(b);
     1681    }
     1682
     1683    while(buckets6) {
     1684        struct bucket *b = buckets6;
     1685        buckets6 = b->next;
    16751686        while(b->nodes) {
    16761687            struct node *n = b->nodes;
  • trunk/third-party/dht/dht.h

    r11655 r11663  
    11/*
    2 Copyright (c) 2009, 2010 by Juliusz Chroboczek
     2Copyright (c) 2009-2011 by Juliusz Chroboczek
    33
    44Permission is hereby granted, free of charge, to any person obtaining a copy
     
    4848int dht_get_nodes(struct sockaddr_in *sin, int *num,
    4949                  struct sockaddr_in6 *sin6, int *num6);
    50 int dht_uninit(int dofree);
     50int dht_uninit(void);
    5151
    5252/* This must be provided by the user. */
Note: See TracChangeset for help on using the changeset viewer.