1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-22 15:54:57 +00:00

fix another OpenBSD alignment bug reported by naddy

This commit is contained in:
Charles Kerr 2008-01-08 01:57:48 +00:00
parent 1abd7fbafa
commit 4f0f6e150e
3 changed files with 12 additions and 12 deletions

View file

@ -548,11 +548,16 @@ parsePeers( tr_torrent * tor, const uint8_t * buf, uint32_t len )
if( !tor->info.isPrivate )
{
int i;
const int count = len / sizeof(tr_pex);
tr_peerMgrAddPex( tor->handle->peerMgr,
tor->info.hash,
TR_PEER_FROM_CACHE,
(tr_pex*)buf, count );
for( i=0; i<count; ++i )
{
tr_pex pex;
readBytes( &pex, &buf, sizeof( tr_pex ) );
tr_peerMgrAddPex( tor->handle->peerMgr, tor->info.hash, TR_PEER_FROM_CACHE, &pex );
}
tr_dbg( "found %i peers in resume file", count );
ret = TR_FR_PEERS;
}

View file

@ -1075,17 +1075,13 @@ void
tr_peerMgrAddPex( tr_peerMgr * manager,
const uint8_t * torrentHash,
uint8_t from,
const tr_pex * pex,
int pexCount )
const tr_pex * pex )
{
Torrent * t;
const tr_pex * end;
managerLock( manager );
t = getExistingTorrent( manager, torrentHash );
for( end=pex+pexCount; pex!=end; ++pex )
ensureAtomExists( t, &pex->in_addr, pex->port, pex->flags, from );
ensureAtomExists( t, &pex->in_addr, pex->port, pex->flags, from );
managerUnlock( manager );
}

View file

@ -50,8 +50,7 @@ void tr_peerMgrAddPeers( tr_peerMgr * manager,
void tr_peerMgrAddPex( tr_peerMgr * manager,
const uint8_t * torrentHash,
uint8_t from,
const tr_pex * pex,
int pexCount );
const tr_pex * pex );
void tr_peerMgrSetBlame( tr_peerMgr * manager,
const uint8_t * torrentHash,