                                              :colls])]
           (if (not (get (:key m) colls))
             (let [nrev (inc (:rev server-state))
-                  coll (make-coll actx nrev (:key m))]
+                  coll (make-coll actx nrev (:key m) (:kvs-mgr-ch server-state))]
               ; TODO: audit log on success and failure.
               [(-> server-state
                    (assoc-in [:realms (:cur-realm m)

(defn coll-handler [actx coll-state m]
  [coll-state nil])

(defn make-coll [actx rev name]
  (let [coll-ch (achan actx)]
    (state-loop actx [:coll name] coll-handler {})
    {:rev rev
     :name name
     :coll-ch coll-ch}))

; --------------------------------------------

(defn make-initial-server-state [actx]
  (let [c (make-coll actx 0 "default")]
    {:rev 0
     :realms {"_system" {:rev 0
                         :users {"admin" {:rev 0 :pswd "password"}}

              "_lobby" {:rev 0
                        :users {"_anon" {:rev 0 :pswd ""}}
                        :collsets {"default" {:rev 0
                                              :colls {"default" default-coll}}}}}
     :kvs-mgr-ch kvs-mgr-ch}))

(defn server-handler [actx server-state m]
  (case (:op m)
