* lib/drb/drb.rb (error_print): Add verbose failure messages and

avoid infamous DRb::DRbConnError. [Feature #12101]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
seki 2016-02-28 11:28:58 +00:00
Родитель 4d9f5482ae
Коммит 018f081233
2 изменённых файлов: 20 добавлений и 7 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Sun Feb 28 20:23:36 2016 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/drb/drb.rb (error_print): Add verbose failure messages and
avoid infamous DRb::DRbConnError. [Feature #12101]
Sun Feb 28 13:40:46 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (nometh_err_initialize): add private_call? parameter.

Просмотреть файл

@ -1632,6 +1632,17 @@ module DRb
include InvokeMethod18Mixin
end
def error_print(exception)
exception.backtrace.inject(true) do |first, x|
if first
$stderr.puts "#{x}: #{exception} (#{exception.class})"
else
$stderr.puts "\tfrom #{x}"
end
false
end
end
# The main loop performed by a DRbServer's internal thread.
#
# Accepts a connection from a client, and starts up its own
@ -1655,13 +1666,10 @@ module DRb
succ = false
invoke_method = InvokeMethod.new(self, client)
succ, result = invoke_method.perform
if !succ && verbose
p result
result.backtrace.each do |x|
puts x
end
end
client.send_reply(succ, result) rescue nil
error_print(result) if !succ && verbose
client.send_reply(succ, result)
rescue Exception => e
error_print(e) if verbose
ensure
client.close unless succ
if Thread.current['DRb']['stop_service']