     (loop [recvd 0]
       (if (= recvd len)
         samples
-        (let [msg (recv-and-wait "/b_setn")
+        (let [msg @(recv "/b_setn")
               ;_ (println "b_setn msg: " (take 3 (:args msg)))
               [buf-id bstart blen & samps] (:args msg)]
           (loop [idx bstart

(defn sync-all
  "Wait until all asynchronous server operations have been completed."
  []
  (recv-and-wait "/synced"))

; The /done message just has a single argument:
; "/done" "s" <completed-command>

  (let [sync-id (rand-int 999999)
        reply-p (recv "/synced")
        _ (snd "/sync" sync-id)
        reply (await-promise reply-p (if timeout timeout REPLY-TIMEOUT))
        reply-id (first (:args reply))]
    (= sync-id reply-id)))

