6163894

Branches > facts > 6163894 > files / src / net / bowmap / server

Move client out of server fact handler

Grahp, 2026-08-22

Commit: 6163894fcb81bc4789915f894ca8e413f4d19abe
Parent: 63fb35e

3 changed files:

src/net/bowmap/protocol/handle.clj modified (view file)

@@ -28,9 +28,8 @@                     ::state/connection-state intent                     :protocol-id protocol)})) -(defmethod handle-packet ::serverbound/status-request [client _]-  {:facts [{::fact/id ::fact/server-list-requested-            ::client/client client}]})+(defmethod handle-packet ::serverbound/status-request [_ _]+  {:facts [{::fact/id ::fact/server-list-requested}]})  (defmethod handle-packet ::serverbound/ping-request [_ pk]   {:packets [{::pk/id ::clientbound/pong-response

src/net/bowmap/protocol/server.clj modified (view file)

@@ -23,10 +23,11 @@                                 (when (some? frame)                                   (let [packet (decode-packet! frame (::state/connection-state client))                                         {:keys [client packets facts] :or {:client client}} (handle/handle-packet client packet)]+                                    ; TODO probably want to clean up this side effecting stuff                                     (doseq [pk packets]                                       (put! clientbound-packets pk))                                     (doseq [fact facts]-                                      (handle-responses! (logic/handle-fact fact)))+                                      (handle-responses! (map #(assoc % ::client/client client) (logic/handle-fact fact))))                                     (recur client))))             clientbound-packets ([packet]                                  (if (some? packet)

src/net/bowmap/server/logic.clj modified (view file)

@@ -1,9 +1,5 @@ (ns net.bowmap.server.logic   (:require-   ; TODO I'd be skeptical of references to protocol stuff from within server...-   ; This is really only here so the response handler can know who to send the response to-   [net.bowmap.protocol.client :as client]-   [net.bowmap.protocol.entity :as entity]    [net.bowmap.server.player :as player]    [net.bowmap.server.server :as server]    [net.bowmap.stormbow.fact :as fact]@@ -13,9 +9,8 @@   (fn [fact]     (::fact/id fact))) -(defmethod handler ::fact/server-list-requested [{:keys! [::client/client]}]+(defmethod handler ::fact/server-list-requested [_]   [{::response/id ::response/send-server-list-    ::client/client client     :server-list-response {:version {:name "26.2"                                      :protocol 776}                            :players {:online (count @server/players)