mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
Unbreak BeOS build.
This commit is contained in:
parent
dc282004c8
commit
d07b688c86
3 changed files with 17 additions and 4 deletions
|
@ -403,3 +403,12 @@ void tr_netClose( int s )
|
||||||
close( s );
|
close( s );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tr_netNtop( const struct in_addr * addr, char * buf, int len )
|
||||||
|
{
|
||||||
|
const uint8_t * cast;
|
||||||
|
|
||||||
|
cast = (const uint8_t *)addr;
|
||||||
|
snprintf( buf, len, "%hhu.%hhu.%hhu.%hhu",
|
||||||
|
cast[0], cast[1], cast[2], cast[3] );
|
||||||
|
}
|
||||||
|
|
|
@ -52,3 +52,4 @@ void tr_netClose ( int s );
|
||||||
int tr_netSend ( int s, uint8_t * buf, int size );
|
int tr_netSend ( int s, uint8_t * buf, int size );
|
||||||
int tr_netRecv ( int s, uint8_t * buf, int size );
|
int tr_netRecv ( int s, uint8_t * buf, int size );
|
||||||
|
|
||||||
|
void tr_netNtop( const struct in_addr * addr, char * buf, int len );
|
||||||
|
|
|
@ -410,6 +410,7 @@ int tr_getFinished( tr_torrent_t * tor )
|
||||||
tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
|
tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
|
||||||
{
|
{
|
||||||
tr_stat_t * s;
|
tr_stat_t * s;
|
||||||
|
tr_peer_t * peer;
|
||||||
tr_info_t * inf = &tor->info;
|
tr_info_t * inf = &tor->info;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -435,7 +436,6 @@ tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
|
||||||
s->peersUploading = 0;
|
s->peersUploading = 0;
|
||||||
s->peersDownloading = 0;
|
s->peersDownloading = 0;
|
||||||
|
|
||||||
tr_peer_t * peer;
|
|
||||||
for( i = 0; i < tor->peerCount; i++ )
|
for( i = 0; i < tor->peerCount; i++ )
|
||||||
{
|
{
|
||||||
peer = tor->peers[i];
|
peer = tor->peers[i];
|
||||||
|
@ -494,11 +494,13 @@ tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
|
||||||
|
|
||||||
tr_peer_stat_t * tr_torrentPeers( tr_torrent_t * tor, int * peerCount )
|
tr_peer_stat_t * tr_torrentPeers( tr_torrent_t * tor, int * peerCount )
|
||||||
{
|
{
|
||||||
|
tr_peer_stat_t * peers;
|
||||||
|
|
||||||
tr_lockLock( &tor->lock );
|
tr_lockLock( &tor->lock );
|
||||||
|
|
||||||
*peerCount = tor->peerCount;
|
*peerCount = tor->peerCount;
|
||||||
|
|
||||||
tr_peer_stat_t * peers = (tr_peer_stat_t *) calloc( tor->peerCount, sizeof( tr_peer_stat_t ) );
|
peers = (tr_peer_stat_t *) calloc( tor->peerCount, sizeof( tr_peer_stat_t ) );
|
||||||
if (peers != NULL)
|
if (peers != NULL)
|
||||||
{
|
{
|
||||||
tr_peer_t * peer;
|
tr_peer_t * peer;
|
||||||
|
@ -511,7 +513,7 @@ tr_peer_stat_t * tr_torrentPeers( tr_torrent_t * tor, int * peerCount )
|
||||||
addr = tr_peerAddress( peer );
|
addr = tr_peerAddress( peer );
|
||||||
if( NULL != addr )
|
if( NULL != addr )
|
||||||
{
|
{
|
||||||
inet_ntop( AF_INET, addr, peers[i].addr,
|
tr_netNtop( addr, peers[i].addr,
|
||||||
sizeof( peers[i].addr ) );
|
sizeof( peers[i].addr ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,10 +532,11 @@ tr_peer_stat_t * tr_torrentPeers( tr_torrent_t * tor, int * peerCount )
|
||||||
|
|
||||||
void tr_torrentPeersFree( tr_peer_stat_t * peers, int peerCount )
|
void tr_torrentPeersFree( tr_peer_stat_t * peers, int peerCount )
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
if (peers == NULL)
|
if (peers == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < peerCount; i++)
|
for (i = 0; i < peerCount; i++)
|
||||||
free( peers[i].client );
|
free( peers[i].client );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue