bce5890
Branches > main > bce5890 > files
Remove codec spec and rename codec namespace to 'packet-serialization'
Commit: bce58908d7b51441bef36b624d049b84b276ca23
Parent: 4ed8ebd
2 changed files:
src/net/bowmap/server/protocol/packet_serialization.clj src/net/bowmap/server/protocol/codec.clj view file
@@ -1,6 +1,5 @@-(ns net.bowmap.server.protocol.codec+(ns net.bowmap.server.protocol.packet-serialization (:require- [clojure.spec.alpha :as s] [net.bowmap.server.protocol.clientbound-packets :as clientbound] [net.bowmap.server.protocol.frame :refer [frame]] [net.bowmap.server.protocol.packet :as packet]@@ -9,9 +8,6 @@ [net.bowmap.server.protocol.serverbound-packets :as serverbound] [net.bowmap.server.protocol.writers :as writers])) -(s/def ::codec (s/or :reader ::readers/reader- :writer ::writers/writer))- (defn encode-packet "Encodes a packet into a frame. Throws when the packet cannot be encoded."src/net/bowmap/server/runtime/connections.clj view file
@@ -3,7 +3,7 @@ [clojure.core.async :refer [<!! alts!! chan io-thread put!]] [net.bowmap.server.network.connection :as connection] [net.bowmap.server.protocol.client :as client]- [net.bowmap.server.protocol.codec :as codec]+ [net.bowmap.server.protocol.packet-serialization :as serialize] [net.bowmap.server.protocol.phase :as phase] [net.bowmap.server.runtime.packets :as packets])) @@ -12,11 +12,11 @@ ([client in x] (case in ::connection/serverbound-frame- (let [[client' packets] (packets/apply-packet client (codec/decode-frame client x))]+ (let [[client' packets] (packets/apply-packet client (serialize/decode-frame client x))] [client' {::client/clientbound-packet-chan packets}]) ::client/clientbound-packet- [client {::connection/clientbound-frame-chan [(codec/encode-packet client x)]}])))+ [client {::connection/clientbound-frame-chan [(serialize/encode-packet client x)]}]))) (defn handle-connection! [{::connection/keys! [serverbound-frame-chan clientbound-frame-chan]}] (let [clientbound-packet-chan (chan 1024)]