about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/rainbows/fiber/base.rb4
-rw-r--r--lib/rainbows/fiber/io.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/rainbows/fiber/base.rb b/lib/rainbows/fiber/base.rb
index c65b07b..b731947 100644
--- a/lib/rainbows/fiber/base.rb
+++ b/lib/rainbows/fiber/base.rb
@@ -103,10 +103,8 @@ module Rainbows
         Error.write(io, e)
       ensure
         G.cur -= 1
-        RD.delete(client)
-        WR.delete(client)
         ZZ.delete(client.f)
-        io.close unless io.closed?
+        client.close
       end
 
     end
diff --git a/lib/rainbows/fiber/io.rb b/lib/rainbows/fiber/io.rb
index 339ac0a..5153070 100644
--- a/lib/rainbows/fiber/io.rb
+++ b/lib/rainbows/fiber/io.rb
@@ -19,7 +19,9 @@ module Rainbows
       end
 
       def close
-        to_io.close
+        RD.delete(self)
+        WR.delete(self)
+        to_io.close unless to_io.closed?
       end
 
       def wait_readable