diff --git a/src/cljx/grub/state.cljx b/src/cljx/grub/state.cljx index a5dabd3..265abe3 100644 --- a/src/cljx/grub/state.cljx +++ b/src/cljx/grub/state.cljx @@ -16,8 +16,6 @@ :diff (let [states* @states shadow (sync/get-history-state states* (:hash msg))] - #+cljs (logs "diff msg:" msg) - #+clj (println "diff msg:" msg) (if shadow (let [new-states (sync/apply-diff states* (:diff msg)) new-shadow (diff/patch-state shadow (:diff msg)) @@ -39,18 +37,14 @@ :full-sync (if client? (let [state (:state msg)] - #+cljs (logs "received full sync") (reset! states (sync/new-state state)) (recur state)) (let [state (sync/get-current-state @states)] - #+clj (println "sending full sync") (>! out (message/full-sync state)) ;; HERE (recur state))) :new-state (let [{:keys [diff hash]} (sync/diff-states (:state msg) shadow)] - #+cljs (logs "new state") - #+clj (println "new state") (when-not (sync/empty-diff? diff) (>! out (message/diff-msg diff hash))) (recur shadow)) @@ -78,12 +72,11 @@ (a/go-loop [] (let [[val _] (a/alts! [! client-events val) - (recur)) - (do #+clj (println "client disconnected, clean up") - (remove-watch states client-id) - (a/close! ! client-events val) + (recur)) + (do (remove-watch states client-id) + (a/close! client states))) #+clj