From 292409542a552e118ddcf122cfe84c42ab53f34b Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Sun, 8 May 2011 12:19:51 -0400 Subject: [PATCH] allow manual close of client connection - closes #11 --- lib/em-proxy/connection.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/em-proxy/connection.rb b/lib/em-proxy/connection.rb index c46bb7e..54f03d9 100644 --- a/lib/em-proxy/connection.rb +++ b/lib/em-proxy/connection.rb @@ -88,15 +88,15 @@ def unbind def unbind_backend(name) debug [:unbind_backend, name] @servers[name] = nil - - # if all connections are terminated downstream, then notify client - close_connection_after_writing if @servers.values.compact.size.zero? + close = :close if @on_finish - @on_finish.call(name) + close = @on_finish.call(name) + end - # not sure if this is required - # @on_finish.call(:done) if @servers.values.compact.size.zero? + # if all connections are terminated downstream, then notify client + if @servers.values.compact.size.zero? and close != :keep + close_connection_after_writing end end