mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
7710bdd120
commit
a48022489f
1 changed files with 3 additions and 9 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue