fix oops from last commit
This commit is contained in:
parent
5ad14e4abc
commit
18b3b388c0
|
@ -149,7 +149,6 @@ myDebug( const char * file, int line, const tr_tracker * t, const char * fmt, ..
|
||||||
**** Connections that know how to clean up after themselves
|
**** Connections that know how to clean up after themselves
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#if 0
|
|
||||||
static int
|
static int
|
||||||
freeConnection( void * evcon )
|
freeConnection( void * evcon )
|
||||||
{
|
{
|
||||||
|
@ -165,13 +164,12 @@ connectionClosedCB( struct evhttp_connection * evcon, void * handle )
|
||||||
has played out */
|
has played out */
|
||||||
tr_timerNew( handle, freeConnection, evcon, 100 );
|
tr_timerNew( handle, freeConnection, evcon, 100 );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct evhttp_connection*
|
static struct evhttp_connection*
|
||||||
getConnection( tr_tracker * t, const char * address, int port )
|
getConnection( tr_tracker * t, const char * address, int port )
|
||||||
{
|
{
|
||||||
struct evhttp_connection * c = evhttp_connection_new( address, port );
|
struct evhttp_connection * c = evhttp_connection_new( address, port );
|
||||||
//evhttp_connection_set_closecb( c, connectionClosedCB, t->handle );
|
evhttp_connection_set_closecb( c, connectionClosedCB, t->handle );
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,6 +986,29 @@ tr_trackerGetCounts( const tr_tracker * t,
|
||||||
*setme_seederCount = t->seederCount;
|
*setme_seederCount = t->seederCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct request_data
|
||||||
|
{
|
||||||
|
tr_tracker * t;
|
||||||
|
const char * command;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
sendRequestFromEventThreadImpl( void * vdata )
|
||||||
|
{
|
||||||
|
struct request_data * data = vdata;
|
||||||
|
sendTrackerRequest( data->t, data->command );
|
||||||
|
tr_free( data );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sendRequestFromEventThread( tr_tracker * t, const char * command )
|
||||||
|
{
|
||||||
|
struct request_data * data = tr_new( struct request_data, 1 );
|
||||||
|
data->t = t;
|
||||||
|
data->command = command;
|
||||||
|
tr_runInEventThread( t->handle, sendRequestFromEventThreadImpl, data );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tr_trackerStart( tr_tracker * t )
|
tr_trackerStart( tr_tracker * t )
|
||||||
{
|
{
|
||||||
|
@ -996,30 +1017,29 @@ tr_trackerStart( tr_tracker * t )
|
||||||
if( !t->reannounceTimer && !t->isRunning )
|
if( !t->reannounceTimer && !t->isRunning )
|
||||||
{
|
{
|
||||||
t->isRunning = 1;
|
t->isRunning = 1;
|
||||||
sendTrackerRequest( t, "started" );
|
sendRequestFromEventThread( t, "started" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tr_trackerReannounce( tr_tracker * t )
|
tr_trackerReannounce( tr_tracker * t )
|
||||||
{
|
{
|
||||||
sendTrackerRequest( t, "started" );
|
sendRequestFromEventThread( t, "started" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tr_trackerCompleted( tr_tracker * t )
|
tr_trackerCompleted( tr_tracker * t )
|
||||||
{
|
{
|
||||||
sendTrackerRequest( t, "completed" );
|
sendRequestFromEventThread( t, "completed" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tr_trackerStop( tr_tracker * t )
|
tr_trackerStop( tr_tracker * t )
|
||||||
{
|
{
|
||||||
dbgmsg( t, " tr_trackerStop called .... t->isRunning is %d", (int)t->isRunning );
|
|
||||||
if( t->isRunning )
|
if( t->isRunning )
|
||||||
{
|
{
|
||||||
t->isRunning = 0;
|
t->isRunning = 0;
|
||||||
sendTrackerRequest( t, "stopped" );
|
sendRequestFromEventThread( t, "stopped" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue