mirror of
https://github.com/transmission/transmission
synced 2025-02-02 20:43:51 +00:00
(trunk libT) modified transmission-dht-20090619.patch
This commit is contained in:
parent
3a707fbcc7
commit
e904ea732c
2 changed files with 13 additions and 1 deletions
|
@ -1443,6 +1443,8 @@ readBtMessage( tr_peermsgs * msgs, struct evbuffer * inbuf, size_t inlen )
|
|||
case BT_PORT:
|
||||
dbgmsg( msgs, "Got a BT_PORT" );
|
||||
tr_peerIoReadUint16( msgs->peer->io, inbuf, &msgs->peer->dht_port );
|
||||
if( msgs->peer->port > 0 )
|
||||
tr_dhtAddNode( msgs->session, &msgs->peer->addr, msgs->peer->dht_port, 0 );
|
||||
break;
|
||||
|
||||
case BT_FEXT_SUGGEST:
|
||||
|
|
|
@ -46,6 +46,7 @@ THE SOFTWARE.
|
|||
#include "trevent.h"
|
||||
#include "tr-dht.h"
|
||||
#include "utils.h"
|
||||
#include "version.h"
|
||||
|
||||
static int dht_socket;
|
||||
static struct event dht_event;
|
||||
|
@ -108,6 +109,7 @@ tr_dhtInit(tr_session *ss)
|
|||
uint8_t * nodes = NULL;
|
||||
const uint8_t * raw;
|
||||
size_t len;
|
||||
char v[5];
|
||||
|
||||
if(session)
|
||||
return -1;
|
||||
|
@ -161,7 +163,8 @@ tr_dhtInit(tr_session *ss)
|
|||
have_id = TRUE;
|
||||
}
|
||||
|
||||
rc = dht_init(dht_socket, myid);
|
||||
tr_snprintf( v, sizeof( v ), "TR%02x", SVN_REVISION_NUM );
|
||||
rc = dht_init( dht_socket, myid, (const unsigned char*)v );
|
||||
if(rc < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -394,3 +397,10 @@ dht_hash(void *hash_return, int hash_size,
|
|||
}
|
||||
memcpy(hash_return, sha1, hash_size > 20 ? 20 : hash_size);
|
||||
}
|
||||
|
||||
int
|
||||
dht_random_bytes( void * buf, size_t size )
|
||||
{
|
||||
tr_cryptoRandBuf( buf, size );
|
||||
return size;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue