Skip to content

Commit 89e5b32

Browse files
committed
Bump clojure-messagepack version
1 parent af161e1 commit 89e5b32

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
com.sun.jmdk/jmxtools
1313
com.sun.jmx/jmxri]]
1414
[clj-logging-config "1.9.12"]
15-
[clojure-msgpack "1.0.0"]]
15+
[clojure-msgpack "1.2.0"]]
1616
:repl-options {:init-ns neovim-client.nvim}
1717
:target-path "target/%s")

src/neovim_client/rpc.clj

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(ns neovim-client.rpc
22
(:require [clojure.core.async :as async]
33
[clojure.tools.logging :as log]
4+
[msgpack.clojure-extensions]
45
[msgpack.core :as msgpack]
56
[neovim-client.message :refer [id value msg-type method params
67
->response-msg]
@@ -16,15 +17,14 @@
1617
(defn- create-input-channel
1718
"Read messages from the input stream, put them on a channel."
1819
[input-stream]
19-
(let [chan (async/chan 1024)
20-
input-stream (DataInputStream. input-stream)]
20+
(let [chan (async/chan 1024)]
2121
(async/go-loop
2222
[]
23-
(when-let [msg (msgpack/unpack-stream input-stream)]
23+
(when-let [msg (msgpack/unpack (DataInputStream. input-stream))]
2424
(log/info "stream -> msg -> in chan: " msg)
2525
(async/>! chan msg)
2626
(recur)))
27-
[chan input-stream]))
27+
chan))
2828

2929
(defn- write-msg!
3030
[packed-msg out-stream]
@@ -35,13 +35,12 @@
3535
(defn- create-output-channel
3636
"Make a channel to read messages from, write to output stream."
3737
[output-stream]
38-
(let [chan (async/chan 1024)
39-
output-stream (DataOutputStream. output-stream)]
38+
(let [chan (async/chan 1024)]
4039
(async/go-loop
4140
[]
4241
(when-let [msg (async/<! chan)]
4342
(log/info "stream <- msg <- out chan: " msg)
44-
(write-msg! (msgpack/pack msg) output-stream)
43+
(write-msg! (msgpack/pack msg) (DataOutputStream. output-stream))
4544
(recur)))
4645
chan))
4746

@@ -66,20 +65,18 @@
6665
(defn stop
6766
"Stop the connection. Right now, this probably only works for debug, when
6867
connected to socket. Don't think we should be trying to .close STDIO streams."
69-
[{:keys [input-stream output-stream out-chan in-chan data-stream]}]
68+
[{:keys [input-stream output-stream out-chan in-chan]}]
7069
(async/close! out-chan)
7170
(async/close! in-chan)
72-
(.close data-stream)
7371
(.close input-stream)
7472
(.close output-stream))
7573

7674
(defn new*
7775
[input-stream output-stream]
78-
(let [[in-chan data-stream] (create-input-channel input-stream)
76+
(let [in-chan (create-input-channel input-stream)
7977
message-table (atom {})
8078
method-table (atom {})
8179
component {:input-stream input-stream
82-
:data-stream data-stream
8380
:output-stream output-stream
8481
:out-chan (create-output-channel output-stream)
8582
:in-chan in-chan

0 commit comments

Comments
 (0)