1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

rewrite the tracker code. this should improve and/or fix a number of bugs, including "too many open files", "router death", "slow internet", and the mutex release crash.

This commit is contained in:
Charles Kerr 2007-11-29 00:43:58 +00:00
parent d56c35b9cd
commit 827dc86bb4
5 changed files with 532 additions and 513 deletions

View file

@ -195,6 +195,7 @@ struct tr_handle
uint8_t isClosed;
struct tr_stats_handle * sessionStats;
struct tr_tracker_handle * tracker;
};
void tr_globalLock ( struct tr_handle * );

File diff suppressed because it is too large Load diff

View file

@ -347,10 +347,12 @@ deadlineReached( const uint64_t deadline )
return tr_date( ) >= deadline;
}
#define SHUTDOWN_MAX_SECONDS 30
void
tr_close( tr_handle * h )
{
const int maxwait_msec = 6 * 1000;
const int maxwait_msec = SHUTDOWN_MAX_SECONDS * 1000;
const uint64_t deadline = tr_date( ) + maxwait_msec;
tr_runInEventThread( h, tr_closeImpl, h );

View file

@ -63,7 +63,6 @@ static int writes = 0;
enum mode
{
TR_EV_EVHTTP_MAKE_REQUEST,
TR_EV_TIMER_ADD,
TR_EV_EXEC
};
@ -130,11 +129,6 @@ pumpList( int i UNUSED, short s UNUSED, void * veh )
++eh->timerCount;
break;
case TR_EV_EVHTTP_MAKE_REQUEST:
evhttp_make_request( cmd->evcon, cmd->req, cmd->evtype, cmd->uri );
tr_free( cmd->uri );
break;
case TR_EV_EXEC:
(cmd->func)( cmd->user_data );
break;
@ -242,28 +236,6 @@ tr_amInEventThread( struct tr_handle * handle )
return tr_amInThread( handle->events->thread );
}
void
tr_evhttp_make_request (tr_handle * handle,
struct evhttp_connection * evcon,
struct evhttp_request * req,
enum evhttp_cmd_type type,
char * uri)
{
if( tr_amInThread( handle->events->thread ) ) {
evhttp_make_request( evcon, req, type, uri );
tr_free( uri );
} else {
struct tr_event_command * cmd = tr_new0( struct tr_event_command, 1 );
cmd->mode = TR_EV_EVHTTP_MAKE_REQUEST;
cmd->evcon = evcon;
cmd->req = req;
cmd->evtype = type;
cmd->uri = uri;
pushList( handle->events, cmd );
}
}
/**
***
**/

View file

@ -31,12 +31,6 @@ struct evhttp_request;
struct evhttp_connection;
struct bufferevent;
void tr_evhttp_make_request (struct tr_handle * tr_handle,
struct evhttp_connection * evcon,
struct evhttp_request * req,
enum evhttp_cmd_type type,
char * uri);
/**
***
**/