【问题标题】:libtorrent alerts - read_piece_alertlibtorrent 警报 - read_piece_alert
【发布时间】:2017-08-16 06:33:07
【问题描述】:

我有一个多文件种子(3 个文件)。我按照here 的说明订阅了 read_piece_alert。

std::vector<alert*> alerts;
ses.pop_alerts(&alerts);
for (alert* i : alerts) {
        switch (a->type()) {

                case read_piece_alert::alert_type:
                {
                        read_piece_alert* p = (read_piece_alert*)a;
                        if (p->ec) {
                                // read_piece failed
                                break;
                        }
                        // use p
                        break;
                }
                case file_renamed_alert::alert_type:
                {
                        // etc...
                }
        }
}

我如何知道该片段属于多文件种子中的哪个文件?

例如,我的多文件种子有 .AVI、.TXT 和 .JPG。是否有某种索引可以知道该片段实际属于哪个文件?

【问题讨论】:

    标签: libtorrent libtorrent-rasterbar


    【解决方案1】:

    是的。您可以使用file_storage 上的map_block() 函数将片段索引映射到一个或多个文件索引+ 偏移量。请参阅documentation

    【讨论】:

      猜你喜欢
      • 2021-06-19
      • 1970-01-01
      • 1970-01-01
      • 2022-10-14
      • 2023-04-06
      • 2019-02-21
      • 2023-03-11
      • 1970-01-01
      • 2018-05-23
      相关资源
      最近更新 更多