                                        (when (< (count (:msgs stream)) max-msgs-per-stream)
                                          [(:send-ch stream)]))
                                       streams)
-                    listenables (vals listens) ; TODO: Handle too many ports case.
                     [v ch] (aalts net (vec (concat [request-listen-ch request-connect-ch]
-                                                   deliveries sendables listenables)))]
+                                                   deliveries sendables)))]
                 (cond
                  (= ch request-listen-ch)
                  (when-let [[addr port accept-ch] v]

                                                         :to-side :send :to-addr to-addr :to-port to-port}))))
                     (do (aclose net result-ch)
                         (recur (inc ts) request-listen-ch request-connect-ch listens streams))))
                 (contains? listenables ch)
                 (if v
                   (recur (inc ts) request-listen-ch request-connect-ch listens streams)
                   (recur (inc ts) request-listen-ch request-connect-ch listens streams))
                 (contains? sendables ch)
                 (if v
                   (recur (inc ts) request-listen-ch request-connect-ch listens streams)
                   (recur (inc ts) request-listen-ch request-connect-ch listens streams))
                 :else ; Must be a deliverable.
                 (recur (inc ts) request-listen-ch request-connect-ch listens streams))))))


(ns cbfg.net
  (:require-macros [cbfg.ago :refer [achan ago-loop aclose aalts aput aput-close]]))

(defn make-net [actx request-listen-ch request-connect-ch max-msgs-per-stream]
  (let [clean-up #()]
