File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change 17
17
" Read messages from the input stream, put them on a channel."
18
18
[input-stream]
19
19
(let [chan (async/chan 1024 )]
20
- ; ; TODO make these threads w/ loops, since they're handling IO
21
- ; ; might explain the wierd drlog blockages
22
- (async/go-loop
23
- []
24
- (when-let [msg (msgpack/unpack input-stream)]
25
- (log/info " stream -> msg -> in chan: " msg)
26
- (async/>! chan msg)
27
- (recur )))
20
+ (async/thread
21
+ (loop []
22
+ (when-let [msg (msgpack/unpack input-stream)]
23
+ (log/info " stream -> msg -> in chan: " msg)
24
+ (async/>!! chan msg)
25
+ (recur ))))
28
26
chan))
29
27
30
28
(defn- write-msg!
37
35
" Make a channel to read messages from, write to output stream."
38
36
[output-stream]
39
37
(let [chan (async/chan 1024 )]
40
- (async/go-loop
41
- []
42
- (when-let [msg (async/<! chan)]
43
- (log/info " stream <- msg <- out chan: " msg)
44
- (write-msg! (msgpack/pack msg) output-stream)
45
- (recur )))
38
+ (async/thread
39
+ ( loop []
40
+ (when-let [msg (async/<! ! chan)]
41
+ (log/info " stream <- msg <- out chan: " msg)
42
+ (write-msg! (msgpack/pack msg) output-stream)
43
+ (recur ) )))
46
44
chan))
47
45
48
46
; ; ***** Public *****
You can’t perform that action at this time.
0 commit comments