 (def idle-backoff-ms 5)
 
 (defn poll-inbox! [{:keys [inbox-ch] :as state}]
-  (update state 
-          :inbox-entries 
-          into 
-          (loop [entries []]
-            (if-let [v (poll! inbox-ch)]
-              (recur (conj entries v))
-              entries))))
+  (if inbox-ch
+    (update state 
+            :inbox-entries 
+            into 
+            (loop [entries []]
+              (if-let [v (poll! inbox-ch)]
+                (recur (conj entries v))
+                entries)))
+    state))
 
 (defn peer-group-manager-loop [state]
   (try 

       (when (and new-state (not= ch shutdown-ch))
         (recur new-state))))
   (catch Throwable t
     (error "Error caught in PeerGroupManager loop." t))))

(defrecord PeerGroupManager [peer-config onyx-vpeer-system-fn]
  component/Lifecycle

         (info t "Attempted to stop OnyxComm component failed.")))
  (-> state
      (assoc :comm nil)
      (assoc :inbox-ch nil)
      (assoc :outbox-ch nil)
      (assoc :connected? false)))

(def spin-park-ms 1)
