X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=tt.rkt;h=5b10215b71858a4ae1694e61df1d5bc8db1d3f79;hb=d54812ea2bb73fdded1074dc19a11dcf0b4de73f;hp=ec46623dc4e7b1b126e0b7625f87ce562e21c0cc;hpb=b056019baff8f82ed9ebe420bcf5abbf0aeec4a7;p=tt.git diff --git a/tt.rkt b/tt.rkt index ec46623..5b10215 100644 --- a/tt.rkt +++ b/tt.rkt @@ -591,15 +591,19 @@ (concurrent-filter-map num-workers (λ (p) (cons p (peer-download timeout p))) peers)) - (define ok? (match-lambda - [(cons _ (cons 'ok _)) #t] - [(cons _ (cons 'error _)) #f])) - (define (err? r) (not (ok? r))) - (define peers-ok (map car (filter ok? results))) - (define peers-err (map car (filter err? results))) + (define peers-ok + (filter-map (match-lambda + [(cons p (cons 'ok _)) p] + [(cons _ (cons 'error e)) #f]) + results)) + (define peers-err + (filter-map (match-lambda + [(cons _ (cons 'ok _)) + #f] + [(cons p (cons 'error e)) + (struct-copy Peer p [comment (format "~s" e)])]) + results)) (peers->file peers-ok (build-path tt-home-dir "peers-last-downloaded-ok")) - ; TODO Append error as a comment: # - ; TODO Support inline/trailing comments in peer files (peers->file peers-err (build-path tt-home-dir "peers-last-downloaded-err"))) (: uniq (∀ (α) (-> (Listof α) (Listof α))))