Permalink
Browse files

Revert "fix channels closing issue"

This reverts commit 2eb5ddf.
  • Loading branch information...
dajac committed Jan 25, 2012
1 parent 2eb5ddf commit 0684a823b0eea9f9526c43f65570e2892100f620
Showing with 11 additions and 22 deletions.
  1. +11 −22 src/aleph/netty.clj
View
@@ -24,8 +24,6 @@
ChannelHandlerContext
MessageEvent
ChannelEvent
ChannelState
ChannelStateEvent
ExceptionEvent
ChannelPipelineFactory
Channels
@@ -295,21 +293,10 @@
[^ChannelGroup channel-group options
connections-probe refuse-connections?
pipeline-fn & args]
(let [connection-count (atom 0)
close-callback (or (options :close-callback) (fn []))]
(let [connection-count (atom 0)]
(reify ChannelPipelineFactory
(getPipeline [_]
(let [pipeline ^ChannelPipeline (apply pipeline-fn args)]
(.addLast pipeline
"close-handler"
(upstream-stage
(fn [evt]
(when
(and (instance? ChannelStateEvent evt)
(= (.getState evt) ChannelState/OPEN)
(= (.getValue evt) false))
(close-callback))
evt)))
(.addFirst pipeline
"channel-listener"
(if (and refuse-connections? @refuse-connections?)
@@ -464,14 +451,7 @@
(.setPipelineFactory client
(create-pipeline-factory
channel-group
(merge options
{:close-callback
(fn []
(close inner)
(close outer)
(run-pipeline (.close channel-group)
wrap-netty-channel-group-future
(fn [_] (future (.releaseExternalResources client)))))})
options
(canonical-probe [(:name options) :connections])
nil
pipeline-fn
@@ -487,6 +467,15 @@
(let [write-queue (create-write-queue
netty-channel
#(write-to-channel netty-channel nil true))]
(run-pipeline (.getCloseFuture netty-channel)
wrap-netty-channel-future
(fn [_]
(close inner)
(close outer)
(run-pipeline
(.close channel-group)
wrap-netty-channel-group-future
(fn [_] (future (.releaseExternalResources client))))))
(.add channel-group netty-channel)
(run-pipeline
(receive-in-order outer

0 comments on commit 0684a82

Please sign in to comment.