dup "announce-list" of [ nip first random ] [ "announce" of ] if* ;
: scrape-url ( metainfo -- url/f )
- announce-url "announce" over path>> subseq? [
+ announce-url dup path>> "announce" subseq-of? [
[ "announce" "scrape" replace ] change-path
] [ drop f ] if ;
:: next-block ( peer -- peer )
peer current-index>> [ 1 + ] [ 0 ] if*
peer #pieces>>
- peer bitfield>> '[ _ check-bitfield ] (find-integer)
+ peer bitfield>> '[ _ check-bitfield ] find-integer-from
peer current-index<<
0 peer current-piece>> set-length
peer ;