Skip to content

Commit 40f0b9f

Browse files
committed
Rename Downstreams from d to dwn
Using dfor non-deferreds is confusing as hell
1 parent 34ed55d commit 40f0b9f

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

src/manifold/stream/graph.clj

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
.iterator
5959
iterator-seq
6060
(map
61-
(fn [^Downstream d]
62-
[(.description d) (.sink d)]))))))
61+
(fn [^Downstream dwn]
62+
[(.description dwn) (.sink dwn)]))))))
6363

6464
(defn pop-connected! [stream]
6565
(when-let [handle (s/weak-handle stream)]
@@ -76,29 +76,29 @@
7676
;;;
7777

7878
(defn- async-send
79-
[^Downstream d msg dsts]
80-
(let [^IEventSink sink (.sink d)]
81-
(let [x (if (== (.timeout d) -1)
79+
[^Downstream dwn msg dsts]
80+
(let [^IEventSink sink (.sink dwn)]
81+
(let [x (if (== (.timeout dwn) -1)
8282
(.put sink msg false)
83-
(.put sink msg false (.timeout d) (if (.downstream? d) sink false)))]
84-
(AsyncPut. x dsts d (.upstream? d)))))
83+
(.put sink msg false (.timeout dwn) (if (.downstream? dwn) sink false)))]
84+
(AsyncPut. x dsts dwn (.upstream? dwn)))))
8585

8686
(defn- sync-send
87-
[^Downstream d msg ^CopyOnWriteArrayList dsts ^IEventSink upstream]
88-
(let [^IEventSink sink (.sink d)
87+
[^Downstream dwn msg ^CopyOnWriteArrayList dsts ^IEventSink upstream]
88+
(let [^IEventSink sink (.sink dwn)
8989
x (try
90-
(if (== (.timeout d) -1)
90+
(if (== (.timeout dwn) -1)
9191
(.put sink msg true)
92-
(.put sink msg true (.timeout d) ::timeout))
92+
(.put sink msg true (.timeout dwn) ::timeout))
9393
(catch Throwable e
9494
(log/error e "error in message propagation")
9595
(s/close! sink)
9696
false))]
9797
(when (false? x)
98-
(.remove dsts d)
98+
(.remove dsts dwn)
9999
(when upstream
100100
(s/close! upstream)))
101-
(when (and (identical? ::timeout x) (.downstream? d))
101+
(when (and (identical? ::timeout x) (.downstream? dwn))
102102
(s/close! sink))))
103103

104104
(defn- handle-async-put [^AsyncPut x val source]
@@ -132,10 +132,10 @@
132132

133133
sync-propagate (fn this [recur-point msg]
134134
(loop []
135-
(let [^Downstream d (.poll sync-sinks)]
136-
(if (nil? d)
135+
(let [^Downstream dwn (.poll sync-sinks)]
136+
(if (nil? dwn)
137137
recur-point
138-
(let [^AsyncPut x (async-send d msg dsts)
138+
(let [^AsyncPut x (async-send dwn msg dsts)
139139
d (.deferred x)
140140
val (d/success-value d ::none)]
141141
(if (identical? val ::none)
@@ -197,9 +197,9 @@
197197
(let [i (.iterator dsts)]
198198
(loop []
199199
(when (.hasNext i)
200-
(let [^Downstream d (.next i)]
201-
(when (.downstream? d)
202-
(s/close! (.sink d)))
200+
(let [^Downstream dwn (.next i)]
201+
(when (.downstream? dwn)
202+
(s/close! (.sink dwn)))
203203
(recur))))))
204204

205205
(== 1 (.size dsts))
@@ -234,10 +234,10 @@
234234
(do
235235
(loop []
236236
(when (.hasNext i)
237-
(let [^Downstream d (.next i)]
238-
(if (s/synchronous? (.sink d))
239-
(.add sync-sinks d)
240-
(.add deferreds (async-send d msg dsts)))
237+
(let [^Downstream dwn (.next i)]
238+
(if (s/synchronous? (.sink dwn))
239+
(.add sync-sinks dwn)
240+
(.add deferreds (async-send dwn msg dsts)))
241241
(recur))))
242242

243243
(async-propagate this msg))))))))))
@@ -259,17 +259,17 @@
259259
(.remove handle->downstreams (s/weak-handle source))
260260
(loop []
261261
(when (.hasNext i)
262-
(let [^Downstream d (.next i)]
263-
(when (.downstream? d)
264-
(s/close! (.sink d)))))))
262+
(let [^Downstream dwn (.next i)]
263+
(when (.downstream? dwn)
264+
(s/close! (.sink dwn)))))))
265265

266266
(do
267267
(loop []
268268
(when (.hasNext i)
269-
(let [^Downstream d (.next i)]
270-
(if (s/synchronous? (.sink d))
271-
(.add sync-sinks d)
272-
(.add deferreds (async-send d msg dsts)))
269+
(let [^Downstream dwn (.next i)]
270+
(if (s/synchronous? (.sink dwn))
271+
(.add sync-sinks dwn)
272+
(.add deferreds (async-send dwn msg dsts)))
273273
(recur))))
274274

275275
(loop []
@@ -284,11 +284,11 @@
284284
(recur)))))
285285

286286
(loop []
287-
(let [^Downstream d (.poll sync-sinks)]
288-
(if (nil? d)
287+
(let [^Downstream dwn (.poll sync-sinks)]
288+
(if (nil? dwn)
289289
nil
290290
(do
291-
(sync-send d msg dsts (when (.upstream? d) source))
291+
(sync-send dwn msg dsts (when (.upstream? dwn) source))
292292
(recur)))))
293293

294294
(recur))))
@@ -309,20 +309,20 @@
309309
downstream? true}
310310
:as opts}]
311311
(locking src
312-
(let [d (Downstream.
313-
timeout
314-
(boolean (and upstream? (instance? IEventSink src)))
315-
downstream?
316-
dst
317-
description)
312+
(let [dwn (Downstream.
313+
timeout
314+
(boolean (and upstream? (instance? IEventSink src)))
315+
downstream?
316+
dst
317+
description)
318318
k (.weakHandle ^IEventStream src ref-queue)]
319319
(if-let [dsts (.get handle->downstreams k)]
320-
(.add ^CopyOnWriteArrayList dsts d)
320+
(.add ^CopyOnWriteArrayList dsts dwn)
321321
(let [dsts (CopyOnWriteArrayList.)]
322322
(if-let [dsts' (.putIfAbsent handle->downstreams k dsts)]
323-
(.add ^CopyOnWriteArrayList dsts' d)
323+
(.add ^CopyOnWriteArrayList dsts' dwn)
324324
(do
325-
(.add ^CopyOnWriteArrayList dsts d)
325+
(.add ^CopyOnWriteArrayList dsts dwn)
326326
(if (s/synchronous? src)
327327
(sync-connect src dsts)
328328
(async-connect src dsts))))))))))

0 commit comments

Comments
 (0)