Remove log statements

This commit is contained in:
Nicholas Kariniemi 2014-10-06 19:21:06 +03:00
parent 7126a6b7b3
commit bd47ec1099

View file

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