Skip to content

Commit

Permalink
Fix race condition btw onto-chan and closing chan
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcompton committed Aug 4, 2015
1 parent 770d30d commit 016ef5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rethinkdb/net.clj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
recv-loop (async/go-loop []
(when (try
(let [resp (read-response* in)]
#_(println "Receiving:" resp)
(println "Receiving:" resp)
(async/>! recv-chan resp))
(catch java.net.SocketException e
false))
Expand Down Expand Up @@ -179,7 +179,7 @@
(case (int type)
;; 1 is a single result, 2 is a result sequence. However they are both wrapped in a vector
;; so onto-chan works correctly for both.
(1 2) (do (async/onto-chan result-chan parsed-resp true)
(1 2) (do (async/<! (async/onto-chan result-chan parsed-resp true)) ;; Need to wait for all values to go onto chan before closing
(clean-up :closed))
;; 3 is a partial sequence.
3 (do (async/onto-chan result-chan parsed-resp false)
Expand Down

0 comments on commit 016ef5a

Please sign in to comment.