summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-25 02:32:10 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-25 02:32:10 +0000
commita48022489f14f22aca34137e998bf7ffdd5c98c1 (patch)
treebf213382c128b4eb1423b4a5aebb9f3dc515e797
parent7710bdd120724e1edd6c00816fb124ee36b0f4e0 (diff)
drb: simplify shutdown pipe close logic
IO#close is idempotent, so we don't need to waste bytecode to check or nil it at shutdown time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/drb/drb.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb
index dd72552..36b2b1a 100644
--- a/lib/drb/drb.rb
+++ b/lib/drb/drb.rb
@@ -961,14 +961,8 @@ module DRb
end
def close_shutdown_pipe
- if @shutdown_pipe_r && !@shutdown_pipe_r.closed?
- @shutdown_pipe_r.close
- @shutdown_pipe_r = nil
- end
- if @shutdown_pipe_w && !@shutdown_pipe_w.closed?
- @shutdown_pipe_w.close
- @shutdown_pipe_w = nil
- end
+ @shutdown_pipe_w.close
+ @shutdown_pipe_r.close
end
private :close_shutdown_pipe
@@ -1001,7 +995,7 @@ module DRb
# Graceful shutdown
def shutdown
- @shutdown_pipe_w.close if @shutdown_pipe_w && !@shutdown_pipe_w.closed?
+ @shutdown_pipe_w.close
end
# Check to see if this connection is alive.