53a6f50
Branches > refactor/use-spec-1 > 53a6f50 > files
Docstrings
Commit: 53a6f5020d372451fcd8afd5f20273992df01130
Parent: 9bacc95
1 changed file:
src/net/bowmap/network/message/client.clj view file
@@ -16,7 +16,10 @@ (:import [io.netty.buffer Unpooled])) -(defn build-packet-ids [registry]+(defn build-packet-ids+ "Builds a map of connection states and message ids to packet ids.+ Message ids may be duplicated across connection states."+ [registry] (build [[state packet-ids] registry [i id] (map-indexed vector packet-ids)] [{::state/connection-state state@@ -27,7 +30,9 @@ :args (s/cat :registry (s/map-of ::state/connection-state (s/coll-of ::msg/id :type vector?))) :ret (s/map-of (s/schema [::state/connection-state ::msg/id]) ::pk/id)) -(defn build-packets [registry]+(defn build-packets+ "Builds a map of message ids to message writers."+ [registry] (reduce (fn [acc [packet-id table]] (assoc acc packet-id (table-> table))) {} registry))@@ -36,15 +41,14 @@ :args (s/cat (s/map-of ::msg/id ::t/table)) :ret (s/map-of ::msg/id ::write/writer)) -; TODO document how ids can be duplicated (def message->packet-ids (build-packet-ids {::state/status [::status-response ::pong-response] ::state/login- ;; TODO just because the serialized form is different doesn't mean they have to be different message ids...- [::login-disconnect ;; Uses JSON instead of a text component :p+ ; TODO do the message ids actually have to be different just because a different encoded format is used for the same logic message?+ [::login-disconnect ; Uses JSON instead of a text component :p ::encryption-request ::login-success ::set-compression