remove a debugging printf
This commit is contained in:
parent
7ed8043c15
commit
69eaaed409
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "transmission.h"
|
||||
#include "bencode.h"
|
||||
#include "torrent.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "ipcparse.h"
|
||||
|
@ -117,6 +118,7 @@ static const struct msg gl_msgs[] =
|
|||
{ "lookup", 2, IPC_MSG_LOOKUP },
|
||||
{ "noop", 2, IPC_MSG_NOOP },
|
||||
{ "not-supported", 2, IPC_MSG_NOTSUP },
|
||||
{ "peer-max", 2, IPC_MSG_PEERMAX },
|
||||
{ "pex", 2, IPC_MSG_PEX },
|
||||
{ "port", 2, IPC_MSG_PORT },
|
||||
{ "quit", 1, IPC_MSG_QUIT },
|
||||
|
@ -169,6 +171,7 @@ static const struct inf gl_stat[] =
|
|||
{ "id", IPC_ST_ID },
|
||||
{ "peers-downloading", IPC_ST_PEERDOWN },
|
||||
{ "peers-from", IPC_ST_PEERFROM },
|
||||
{ "peers-max", IPC_ST_PEERMAX },
|
||||
{ "peers-total", IPC_ST_PEERTOTAL },
|
||||
{ "peers-uploading", IPC_ST_PEERUP },
|
||||
{ "running", IPC_ST_RUNNING },
|
||||
|
@ -656,13 +659,14 @@ ipc_addinfo( tr_benc * list,
|
|||
* It specifies what to put in the dictionary.
|
||||
*/
|
||||
int
|
||||
ipc_addstat( tr_benc * list,
|
||||
int torrent_id,
|
||||
const tr_stat * st,
|
||||
int types )
|
||||
ipc_addstat( tr_benc * list,
|
||||
int torrent_id,
|
||||
tr_torrent * tor,
|
||||
int types )
|
||||
{
|
||||
tr_benc * dict;
|
||||
int ii, used;
|
||||
const tr_stat * st = tr_torrentStatCached( tor );
|
||||
tr_benc * dict;
|
||||
int ii, used;
|
||||
|
||||
/* add the dictionary child */
|
||||
tr_bencListReserve( list, 1 );
|
||||
|
@ -782,6 +786,9 @@ ipc_addstat( tr_benc * list,
|
|||
tr_bencInitInt( tr_bencDictAdd( item, "pex" ),
|
||||
st->peersFrom[TR_PEER_FROM_PEX] );
|
||||
break;
|
||||
case IPC_ST_PEERMAX:
|
||||
tr_bencInitInt( item, tor->maxConnectedPeers );
|
||||
break;
|
||||
case IPC_ST_PEERTOTAL:
|
||||
tr_bencInitInt( item, st->peersConnected );
|
||||
break;
|
||||
|
|
|
@ -60,6 +60,7 @@ enum ipc_msg
|
|||
IPC_MSG_LOOKUP,
|
||||
IPC_MSG_NOOP,
|
||||
IPC_MSG_NOTSUP,
|
||||
IPC_MSG_PEERMAX,
|
||||
IPC_MSG_PEX,
|
||||
IPC_MSG_PORT,
|
||||
IPC_MSG_QUIT,
|
||||
|
@ -108,18 +109,19 @@ enum ipc_msg
|
|||
#define IPC_ST_ID ( 1 << 7 )
|
||||
#define IPC_ST_PEERDOWN ( 1 << 8 )
|
||||
#define IPC_ST_PEERFROM ( 1 << 9 )
|
||||
#define IPC_ST_PEERTOTAL ( 1 << 10 )
|
||||
#define IPC_ST_PEERUP ( 1 << 11 )
|
||||
#define IPC_ST_RUNNING ( 1 << 12 )
|
||||
#define IPC_ST_TKDONE ( 1 << 13 )
|
||||
#define IPC_ST_TKLEECH ( 1 << 14 )
|
||||
#define IPC_ST_TKSEED ( 1 << 15 )
|
||||
#define IPC_ST_STATE ( 1 << 16 )
|
||||
#define IPC_ST_SWARM ( 1 << 17 )
|
||||
#define IPC_ST_TRACKER ( 1 << 18 )
|
||||
#define IPC_ST_UPSPEED ( 1 << 19 )
|
||||
#define IPC_ST_UPTOTAL ( 1 << 20 )
|
||||
#define IPC_ST__MAX ( 1 << 21 )
|
||||
#define IPC_ST_PEERMAX ( 1 << 10 )
|
||||
#define IPC_ST_PEERTOTAL ( 1 << 11 )
|
||||
#define IPC_ST_PEERUP ( 1 << 12 )
|
||||
#define IPC_ST_RUNNING ( 1 << 13 )
|
||||
#define IPC_ST_TKDONE ( 1 << 14 )
|
||||
#define IPC_ST_TKLEECH ( 1 << 15 )
|
||||
#define IPC_ST_TKSEED ( 1 << 16 )
|
||||
#define IPC_ST_STATE ( 1 << 17 )
|
||||
#define IPC_ST_SWARM ( 1 << 18 )
|
||||
#define IPC_ST_TRACKER ( 1 << 19 )
|
||||
#define IPC_ST_UPSPEED ( 1 << 20 )
|
||||
#define IPC_ST_UPTOTAL ( 1 << 21 )
|
||||
#define IPC_ST__MAX ( 1 << 22 )
|
||||
|
||||
struct ipc_funcs;
|
||||
struct ipc_info;
|
||||
|
@ -170,8 +172,13 @@ uint8_t * ipc_createInfoRequest( const struct ipc_info * session,
|
|||
|
||||
int ipc_addinfo ( struct tr_benc *, int,
|
||||
const struct tr_info *, int );
|
||||
int ipc_addstat ( struct tr_benc *, int,
|
||||
const struct tr_stat *, int );
|
||||
|
||||
struct tr_torrent;
|
||||
|
||||
int ipc_addstat ( struct tr_benc * appendme_list,
|
||||
int torrent_id,
|
||||
struct tr_torrent * tor,
|
||||
int stat_types );
|
||||
|
||||
/* sets errno to EINVAL on parse error or
|
||||
EPERM for unsupported protocol version */
|
||||
|
|
|
@ -115,7 +115,6 @@ incomingPeersPulse( tr_shared * s )
|
|||
int socket;
|
||||
errno = 0;
|
||||
socket = tr_netBindTCP( s->publicPort );
|
||||
fprintf( stderr, "opening socket on %d to listen\n", s->publicPort );
|
||||
if( socket >= 0 ) {
|
||||
tr_ninf( getKey(), _( "Opened port %d to listen for incoming peer connections" ), s->publicPort );
|
||||
s->bindPort = s->publicPort;
|
||||
|
|
|
@ -546,7 +546,7 @@ tr_torrentGetRates( const tr_torrent * tor,
|
|||
const tr_info *
|
||||
tr_torrentInfo( const tr_torrent * tor )
|
||||
{
|
||||
return &tor->info;
|
||||
return tor ? &tor->info : NULL;
|
||||
}
|
||||
|
||||
const tr_stat *
|
||||
|
@ -554,8 +554,8 @@ tr_torrentStatCached( tr_torrent * tor )
|
|||
{
|
||||
const time_t now = time( NULL );
|
||||
|
||||
return now == tor->lastStatTime ? &tor->stats
|
||||
: tr_torrentStat( tor );
|
||||
return tor && ( now == tor->lastStatTime ) ? &tor->stats
|
||||
: tr_torrentStat( tor );
|
||||
}
|
||||
|
||||
tr_torrent_status
|
||||
|
@ -581,6 +581,9 @@ tr_torrentStat( tr_torrent * tor )
|
|||
tr_stat * s;
|
||||
struct tr_tracker * tc;
|
||||
|
||||
if( !tor )
|
||||
return NULL;
|
||||
|
||||
tr_torrentLock( tor );
|
||||
|
||||
tor->lastStatTime = time( NULL );
|
||||
|
|
Loading…
Reference in New Issue