                                             nil))
                                (atom #{})
                                [in out])]
-
-    #_(go-loop [o (<! out)]
-      (println "OUT" o)
-      (recur (<! out)))
     (go-loop [i (<! new-in)]
       (println "NEW-IN" i)
       (recur (<! new-in)))
-
     (go
       (>! in {:topic :meta-pub,
               :peer "STAGE",

      (println "OUT" (<! out))
      ))


  (println "\n")


  )

                  (do
                   (>! out {:topic ::auth-required :users (set (map :user not-auth)) :tries-left (- 5 counter)})
                   (<! (go-loop [p (<! pub-ch)]
                         (if (= (:topic p) ::auth)
                           (swap! sessions (fn [old new] (apply assoc old new))
                                  (->> (:users p)
                                       (map
                                        (fn [[k v]]
                                          (vec [k
                                                (if (credential-fn {:username k :password v})
                                                  (-> {(uuid) (java.util.Date.)})
                                                  nil)])))
                                       flatten))
                           (recur (<! pub-ch)))))
                   (recur (inc counter))))))))))
    (recur (<! pub-ch))))


(defn- auth-required
  "Sends the credntials of given users back using a given authentication function"
  [auth-req-ch auth-fn out]
  (go-loop [{:keys [users] :as a} (<! auth-req-ch)]
    (when a
      (debug "AUTH-REQ" users)
