}
static int
-deadlineReached( const uint64_t deadline )
+deadlineReached( const time_t deadline )
{
- return tr_date( ) >= deadline;
+ return time( NULL ) >= deadline;
}
#define SHUTDOWN_MAX_SECONDS 20
void
tr_sessionClose( tr_session * session )
{
- const int maxwait_msec = SHUTDOWN_MAX_SECONDS * 1000;
- const uint64_t deadline = tr_date( ) + maxwait_msec;
+ const time_t deadline = time( NULL ) + SHUTDOWN_MAX_SECONDS;
assert( tr_isSession( session ) );
{
static tr_bool forced = FALSE;
dbgmsg( "waiting for libtransmission thread to finish" );
- tr_wait_msec( 100 );
+ tr_wait_msec( 500 );
if( deadlineReached( deadline ) && !forced )
{
event_loopbreak( );
forced = TRUE;
+
+ if( time( NULL ) >= deadline + 3 )
+ break;
}
}