Changeset 6510


Ignore:
Timestamp:
Aug 14, 2008, 2:12:29 AM (13 years ago)
Author:
charles
Message:

#1156: make the RPC callbacks a little more flexible to make thread issues easier on the mac client

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r6490 r6510  
    317317}
    318318
    319 static void
     319static tr_rpc_callback_status
    320320onRPCChanged( tr_handle            * handle UNUSED,
    321321              tr_rpc_callback_type   type,
     
    332332    data->cbdata = cbdata;
    333333    g_idle_add( onRPCIdle, data );
     334    return TR_RPC_OK;
    334335}
    335336
  • trunk/libtransmission/rpc.c

    r6496 r6510  
    3131***/
    3232
    33 static void
     33static tr_rpc_callback_status
    3434notify( tr_handle * session, int type, tr_torrent * tor )
    3535{
     36    tr_rpc_callback_status status = 0;
     37
    3638    if( session->rpc_func )
    37         session->rpc_func( session, type, tor, session->rpc_func_user_data );
     39        status = session->rpc_func( session, type, tor, session->rpc_func_user_data );
     40
     41    return status;
    3842}
    3943
     
    130134    {
    131135        tr_torrent * tor = torrents[i];
    132         notify( h, TR_RPC_TORRENT_REMOVING, tor );
    133         tr_torrentRemove( tor );
     136        const tr_rpc_callback_status status = notify( h, TR_RPC_TORRENT_REMOVING, tor );
     137        if( ! ( status & TR_RPC_NOREMOVE ) )
     138            tr_torrentRemove( tor );
    134139    }
    135140    tr_free( torrents );
  • trunk/libtransmission/transmission.h

    r6496 r6510  
    422422tr_rpc_callback_type;
    423423
    424 typedef void ( *tr_rpc_func )( tr_session           * handle,
    425                                tr_rpc_callback_type   type,
    426                                struct tr_torrent    * tor_or_null,
    427                                void                 * user_data );
     424typedef enum
     425{
     426    /* no special handling is needed by the caller */
     427    TR_RPC_OK            = 0,
     428
     429    /* indicates to the caller that the client will take care of
     430     * removing the torrent itself.  For example the client may
     431     * need to keep the torrent alive long enough to cleanly close
     432     * some resources in another thread. */
     433    TR_RPC_NOREMOVE   = (1<<1)
     434}
     435tr_rpc_callback_status;
     436
     437typedef tr_rpc_callback_status ( *tr_rpc_func )( tr_session           * handle,
     438                                                 tr_rpc_callback_type   type,
     439                                                 struct tr_torrent    * tor_or_null,
     440                                                 void                 * user_data );
    428441
    429442void tr_sessionSetRPCCallback( tr_session   * handle,
Note: See TracChangeset for help on using the changeset viewer.