From f4a5315ec47fcf503f44608422bca30179bc593d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 14 Aug 2008 02:12:29 +0000 Subject: [PATCH] #1156: make the RPC callbacks a little more flexible to make thread issues easier on the mac client --- gtk/main.c | 3 ++- libtransmission/rpc.c | 13 +++++++++---- libtransmission/transmission.h | 21 +++++++++++++++++---- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/gtk/main.c b/gtk/main.c index 5dec78b9f..105a9ef27 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -316,7 +316,7 @@ onRPCIdle( void * vdata ) return FALSE; } -static void +static tr_rpc_callback_status onRPCChanged( tr_handle * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * tor, @@ -331,6 +331,7 @@ onRPCChanged( tr_handle * handle UNUSED, data->tor = type == TR_RPC_TORRENT_REMOVING ? NULL : tor; data->cbdata = cbdata; g_idle_add( onRPCIdle, data ); + return TR_RPC_OK; } int diff --git a/libtransmission/rpc.c b/libtransmission/rpc.c index 39c5e45fc..b5357cebf 100644 --- a/libtransmission/rpc.c +++ b/libtransmission/rpc.c @@ -30,11 +30,15 @@ **** ***/ -static void +static tr_rpc_callback_status notify( tr_handle * session, int type, tr_torrent * tor ) { + tr_rpc_callback_status status = 0; + if( session->rpc_func ) - session->rpc_func( session, type, tor, session->rpc_func_user_data ); + status = session->rpc_func( session, type, tor, session->rpc_func_user_data ); + + return status; } /*** @@ -129,8 +133,9 @@ torrentRemove( tr_handle * h, tr_benc * args_in, tr_benc * args_out UNUSED ) for( i=0; i