 
 
 
-(defn connect [peer conn-ch]
+(defn connect [peer conn-ch out]
   (go-loop [{:keys [ip4 port] :as c} (<! conn-ch)]
            (when c
              (let [[bus-in bus-out] (:chans (:volatile @peer))

                                       "Testing."
                                       false
                                       {:some 42})
            stage (<! (wire-stage peer stage))
            out (second (:chans stage))
            _ (>! out {:type :meta-sub
                       :metas {"me@mail.com" #{(:id (:meta stage))}}})
            _ (<! (timeout 1000))
            _ (>! out {:type :connect
                       :ip4 "127.0.0.1"
                       :port 9090})
            _ (<! (timeout 1000))
            new-stage (<! (sync! stage))]
        (-> new-stage
            (s/transact {:helo :world} '(fn more [old params] old))
            repo/commit
            sync!

               (put! subed-ch (<! c-in))
               (subscribe peer subed-ch bus-out c-out)

               (<! (wire peer [c-out (async/pub c-in :type)]))
               (>! out {:type :connected
                        :ip4 ip4 :port port})
               (recur (<! conn-ch))))))


