Ignore:
Timestamp:
Jan 31, 2013, 9:58:25 PM (8 years ago)
Author:
jordan
Message:

(libT) change the API signature for tr_torrentVerify() s.t. client code can be notified when the verify is finished

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/verify.c

    r13868 r13913  
    174174struct verify_node
    175175{
    176   tr_torrent *         torrent;
    177   tr_verify_done_cb    verify_done_cb;
    178   uint64_t             current_size;
     176  tr_torrent          * torrent;
     177  tr_verify_done_func   callback_func;
     178  void                * callback_data;
     179  uint64_t              current_size;
    179180};
    180 
    181 static void
    182 fireCheckDone (tr_torrent * tor, tr_verify_done_cb verify_done_cb)
    183 {
    184   assert (tr_isTorrent (tor));
    185 
    186   if (verify_done_cb)
    187     verify_done_cb (tor);
    188 }
    189181
    190182static struct verify_node currentNode;
     
    234226      assert (tr_isTorrent (tor));
    235227
    236       if (!stopCurrent)
    237         {
    238           if (changed)
    239             tr_torrentSetDirty (tor);
    240           fireCheckDone (tor, currentNode.verify_done_cb);
    241         }
     228      if (!stopCurrent && changed)
     229        tr_torrentSetDirty (tor);
     230
     231      if (currentNode.callback_func)
     232        (*currentNode.callback_func)(tor, stopCurrent, currentNode.callback_data);
    242233    }
    243234
     
    267258
    268259void
    269 tr_verifyAdd (tr_torrent * tor, tr_verify_done_cb verify_done_cb)
     260tr_verifyAdd (tr_torrent           * tor,
     261              tr_verify_done_func    callback_func,
     262              void                 * callback_data)
    270263{
    271264  struct verify_node * node;
     
    276269  node = tr_new (struct verify_node, 1);
    277270  node->torrent = tor;
    278   node->verify_done_cb = verify_done_cb;
     271  node->callback_func = callback_func;
     272  node->callback_data = callback_data;
    279273  node->current_size = tr_torrentGetCurrentSizeOnDisk (tor);
    280274
Note: See TracChangeset for help on using the changeset viewer.