Implement the server half of the CurveCP protocol
Implement the server half of the CurveCP protocol
(build-event-loop-stopper {:keys [:frereth.cp.server.state/client-read-chan]
                           :as this})(check-packet-length log-state packet)Could this packet possibly be a valid CurveCP packet, based on its size?
Could this packet possibly be a valid CurveCP packet, based on its size?
(ctor {:keys [:frereth.cp.server.state/max-active-clients]
       log-state :frereth.weald.specs/state
       :or {max-active-clients default-max-clients}
       :as cfg})Just like in the Component lifecycle, this is about setting up a value that's ready to start
Just like in the Component lifecycle, this is about setting up a value that's ready to start
(do-begin {:keys [:frereth.cp.server.state/client-read-chan]
           log-state :frereth.weald.specs/state
           :as this})Start the event loop
Start the event loop
(do-handle-incoming {log-state :frereth.weald.specs/state :as this}
                    {:keys [:host :port] message :message :as packet})Packet arrived from client. Do something with it.
Packet arrived from client. Do something with it.
(input-reducer {:keys [:frereth.cp.server.state/client-read-chan
                       :frereth.weald.specs/logger]
                log-state :frereth.weald.specs/state
                :as this}
               msg)Convert input into the next state
Convert input into the next state
(start! {:keys [:frereth.weald.specs/logger
                :frereth.cp.server.state/client-read-chan
                :frereth.cp.server.state/client-write-chan
                :frereth.cp.shared/extension :frereth.cp.shared/my-keys]
         log-state :frereth.weald.specs/state
         :as this})Start a server
Start a server
(stop! {:keys [:frereth.weald.specs/logger
               :frereth.cp.server.state/event-loop-stopper!]
        log-state :frereth.weald.specs/state
        :as this})Stop the ioloop (but not the read/write channels: we don't own them)
Stop the ioloop (but not the read/write channels: we don't own them)
(verify-my-packet {:keys [:frereth.cp.shared/extension]
                   log-state :frereth.weald.specs/state}
                  header
                  rcvd-xtn)Was this packet really intended for this server?
Was this packet really intended for this server?
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |