cljs.repl.server/connection

functionsince v0.0-1503Edit
(connection)

Source docstring:
Promise to return a connection when one is available. If no connection is
available put the promise into a FIFO queue to get the next available
connection.
Source code @ clojurescript:src/main/clojure/cljs/repl/server.clj
(defn connection
  []
  (locking lock
    (let [p (promise)
          conn (.poll connq)]
      (if (and conn (not (.isClosed conn)))
        (deliver p conn)
        (.offer promiseq p))
      p)))