mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
drb: close graceful shutdown pipe before socket
Closing a listen socket while entering select(2) may trigger IOError or even deadlock because another thread may give the file descriptor to another file description; meaning the kernel can wait on the wrong description. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a48022489f
commit
7c31c2738c
2 changed files with 2 additions and 0 deletions
|
@ -953,6 +953,7 @@ module DRb
|
||||||
# returned by #open or by #accept, then it closes this particular
|
# returned by #open or by #accept, then it closes this particular
|
||||||
# client-server session.
|
# client-server session.
|
||||||
def close
|
def close
|
||||||
|
shutdown
|
||||||
if @socket
|
if @socket
|
||||||
@socket.close
|
@socket.close
|
||||||
@socket = nil
|
@socket = nil
|
||||||
|
|
|
@ -95,6 +95,7 @@ module DRb
|
||||||
public
|
public
|
||||||
def close
|
def close
|
||||||
return unless @socket
|
return unless @socket
|
||||||
|
shutdown # DRbProtocol#shutdown
|
||||||
path = @socket.path if @server_mode
|
path = @socket.path if @server_mode
|
||||||
@socket.close
|
@socket.close
|
||||||
File.unlink(path) if @server_mode
|
File.unlink(path) if @server_mode
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue