Skip to content

Commit

Permalink
Merge pull request #370 from kachayev/fix-transit-reader-pushback
Browse files Browse the repository at this point in the history
Do not check .available when reading from input stream to avoid race condition
  • Loading branch information
ztellman committed Apr 3, 2018
2 parents 63ef527 + c66d8f1 commit bbedd0d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/aleph/http/client_middleware.clj
Expand Up @@ -74,10 +74,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 bbedd0d

Please sign in to comment.