aa17513
Branches > facts > aa17513 > files / src / net / bowmap / stormbow
well you cain't do that can you
Commit: aa17513f12f8e8c57de28eb56d0d315cfbdb9f0e
Parent: 13bd5fb
2 changed files:
src/net/bowmap/network/server.clj view file
@@ -14,10 +14,10 @@ (defn handle-connection [connection] (io-thread- (try- (let [client (client/client connection)- clientbound-packets (req! client ::client/clientbound-packets)- serverbound-frames (req! connection ::connection/serverbound-frames)]+ (let [client (client/client connection)+ clientbound-packets (req! client ::client/clientbound-packets)+ serverbound-frames (req! connection ::connection/serverbound-frames)]+ (try (loop [client client] (alt!! serverbound-frames ([frame]@@ -33,12 +33,12 @@ (if (some? pk) (do (send-packet!! client pk) (recur client))- (throw (Exception. "Clientbound packets was closed idk why")))))))- (finally- ; TODO Send player disconnected fact, and update the player list from that- (handle-responses! (logic/handle-fact {::fact/id ::fact/player-left- ::entity/uuid (::entity/uuid client)}))- (connection/close! connection)))))+ (throw (Exception. "Clientbound packets was closed idk why"))))))+ (finally+ ; TODO Send player disconnected fact, and update the player list from that+ #_(handle-responses! (logic/handle-fact {::fact/id ::fact/player-left+ ::entity/uuid (::entity/uuid client)}))+ (connection/close! connection)))))) (defn start-server! [port] (let [connections (mc/start-server! port)]src/net/bowmap/server/logic.clj view file
@@ -31,6 +31,10 @@ (commute server/players assoc uuid player)) [])) +(defmethod handler ::fact/player-left [{:keys! [::entity/uuid]}]+ (commute server/players dissoc uuid)+ [])+ ; Returns a seq of responses ; And document that this is not called synchronously (hence the transactions as well) (defn handle-fact [fact]