Skip to content

Commit

Permalink
Do not check .available when reading from input stream as it creates …
Browse files Browse the repository at this point in the history
…race condition
  • Loading branch information
kachayev committed Mar 15, 2018
1 parent 58b8366 commit c66d8f1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/aleph/http/client_middleware.clj
Expand Up @@ -75,10 +75,9 @@
"Resolve and apply Transit's JSON/MessagePack decoding."
[^InputStream in type & [opts]]
{:pre [transit-enabled?]}
(when (pos? (.available in))
(let [reader (ns-resolve 'cognitect.transit 'reader)
read (ns-resolve 'cognitect.transit 'read)]
(read (reader in type (transit-read-opts opts))))))
(let [reader (ns-resolve 'cognitect.transit 'reader)
read (ns-resolve 'cognitect.transit 'read)]
(read (reader in type (transit-read-opts opts)))))

(defn ^:dynamic transit-encode
"Resolve and apply Transit's JSON/MessagePack encoding."
Expand Down

0 comments on commit c66d8f1

Please sign in to comment.