       [server-state (assoc m :status :not-authenticated)])
     nil))
 
+; --------------------------------------------
+
+(defn lane-handler [actx lane-state m]
+  (case (:op m)
+    :update-realm-user
+    [(assoc lane-state :realm (:realm m) :user (:user m)) (assoc m :status :ok)]
+    "realms-list"
+    (do (act fwd-realms-list actx
+             (aput fwd-realms-list (:server-state-ch m)
+                   (assoc m :realm (:realm lane-state) :user (:user lane-state))))
+        [lane-state nil])
+    nil))
+
+; --------------------------------------------
+
 (defn rq-authenticate [actx m]
   (act rq-authenticate actx
        (let [{:keys [server-state-ch lane-state-ch realm user]} m

                       (assoc m :op :authenticate))]
         (if (= (:status res) :ok)
           (areq rq-authenticate lane-state-ch
                 (assoc m :op :update-cred :cred {:realm realm :user user}))
           res))))

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

(defn lane-handler [actx lane-state m]
  (case (:op m)
    :update-cred
    [(assoc lane-state :cred (:cred m)) (assoc m :status :ok)]
    "realms-list"
    (let [server-state-ch (:server-state-ch m)]
      (act fwd-realms-list actx
           (aput fwd-realms-list server-state-ch
                 (assoc m :cred (:cred lane-state))))
      [lane-state nil])
    nil))

(defn rq-fwd-to-lane [actx m] ; Forward to lane-state-ch to handle the request.
  (act rq-fwd-to-lane actx
       (areq rq-fwd-to-lane (:lane-state-ch m) m)))

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

(def rq-handlers
  {"authenticate" rq-authenticate
   "realms-list" rq-fwd-to-lane
   "add" cbfg.world.base/example-add
   "sub" cbfg.world.base/example-add
   "count" cbfg.world.base/example-count

                    (aput-close state-loop (:res-ch m) res))
                  (recur name state-next))))
    req-ch))

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

(defn fwd [actx ch-key m]
  (act fwd actx
       (println :fwd ch-key m)
       (areq fwd (ch-key m) m)))

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

