summaryrefslogtreecommitdiff
path: root/src/org/gnu/clojure/gnunet/hostlist.clj
blob: f1e20cb8f30be12c00d22ab00a36753cfc1f927d (plain)
1
2
3
4
5
6
7
8
9
10
11
(ns org.gnu.clojure.gnunet.hostlist
  (:use (org.gnu.clojure.gnunet parser message hello iostream)))

(defn download-hostlist
  "Calls the hello-processor on all parsed hello messages at the given URL."
  [url hello-processor]
  (doseq [msg (first ((none-or-more parse-message) (read-url url)))
        :while (== (:message-type msg) message-type-hello)]
    (try
      (hello-processor (first (parse-hello (:bytes msg))))
      (catch Exception e nil))))