ba43832

Branches > main > ba43832 > files / src / net / bowmap

move net.bowmap.server to net.bowmap.network.server

Grahp, 2026-06-02

Commit: ba43832ae4c6deca44ef1f2181472c6afabd589c
Parent: e26c58d

2 changed files:

src/net/bowmap/core.clj modified (view file)

@@ -1,12 +1,12 @@ (ns net.bowmap.core   (:require    [clojure.core.async :refer [>!! alt!! chan]]-   [net.bowmap.network.client :as c]-   [net.bowmap.network.message.client :as client]-   [net.bowmap.network.message.server :as server]+   [net.bowmap.network.client :as client]+   [net.bowmap.network.message.client :as cl]+   [net.bowmap.network.message.server :as srv]+   [net.bowmap.network.server :as server]    [net.bowmap.network.state :as state]-   [net.bowmap.packet-handling :as handle]-   [net.bowmap.server :as server-process]))+   [net.bowmap.packet-handling :as handle]))  ;; TODO server should just provide messages in/out @@ -15,10 +15,9 @@    Because packet reading is dependent on the state of the client, and handling a packet can update the state of the client,    Reading and handling must be synchronized!"   [pk client]-  (when-some [msg (server/packet->message pk (::state/connection-state client))]+  (when-some [msg (srv/packet->message pk (::state/connection-state client))]     (handle/handle-packet!! client msg))) - ; TODO bad positional arguments, use a map? ; TODO only send in things to the server, the rest is stateful (defn handle-packets-and-messages [client packets-in messages-out packets-out]@@ -27,7 +26,7 @@                   (when msg                     ; Make one of these keepalive                     ; How does keepalive begin though?-                    (assert (>!! packets-out (client/message->packet msg (::state/connection-state client))))+                    (assert (>!! packets-out (cl/message->packet msg (::state/connection-state client))))                     client))     packets-in ([pk]                 (when pk@@ -39,7 +38,7 @@   (let [messages-out (chan) ; Use like 1024 so it can block but only when bad things are happening bad things are afoot         client-state {::state/connection-state ::state/handshaking                       ; TODO this is used but get rid of it/make it generic and pass it around not a key of player-                      ::c/messages-out messages-out}]+                      ::client/messages-out messages-out}]     ; Client is not data     (loop [client client-state]       ; TODO this can just... stop the loop@@ -47,7 +46,7 @@         (recur client)))))  (defn start-server []-  (server-process/start-server! {:handler #'client-handler+  (server/start-server! {:handler #'client-handler                                  :logger-fn prn                                  :port 25565})) 

src/net/bowmap/network/server.clj renamed from src/net/bowmap/server.clj (view file)

@@ -1,11 +1,8 @@-(ns net.bowmap.server+(ns net.bowmap.network.server   (:require    [aleph.tcp :as tcp]-   [clojure.alpha.spec :as spec]    [clojure.core.async :refer [chan io-thread]]-   [dev.grahp.spec :as S]    [manifold.stream :as s]-   [net.bowmap.network.packet :as pk]    [net.bowmap.network.packet.read :as read :refer [->varint]])   (:import    [io.netty.bootstrap ServerBootstrap]