summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-28 07:45:27 +0000
committerseki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-28 07:45:27 +0000
commit82a64917c7268f7993a080a921a8a963b48ebdb8 (patch)
tree9819d591b4a23290938160d1403881180b5c4565
parentda73c60789ad4ca6f33f1007535a1a720f126c5c (diff)
downloadruby-82a64917c7268f7993a080a921a8a963b48ebdb8.tar.gz
ruby-82a64917c7268f7993a080a921a8a963b48ebdb8.tar.xz
ruby-82a64917c7268f7993a080a921a8a963b48ebdb8.zip
rescue SystemCallError
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/drb/drb.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb
index fda18401d..20e17bd25 100644
--- a/lib/drb/drb.rb
+++ b/lib/drb/drb.rb
@@ -353,7 +353,13 @@ module DRb
# Error raised when an error occurs on the underlying communication
# protocol.
- class DRbConnError < DRbError; end
+ class DRbConnError < DRbError
+ def self.new_with_error(cause)
+ conn_error = self.new(cause.message)
+ conn_error.set_backtrace(cause.backtrace)
+ conn_error
+ end
+ end
# Class responsible for converting between an object and its id.
#
@@ -549,12 +555,20 @@ module DRb
end
def load(soc) # :nodoc:
- sz = soc.read(4) # sizeof (N)
+ begin
+ sz = soc.read(4) # sizeof (N)
+ rescue
+ raise(DRbConnError.new_with_error($!))
+ end
raise(DRbConnError, 'connection closed') if sz.nil?
raise(DRbConnError, 'premature header') if sz.size < 4
sz = sz.unpack('N')[0]
raise(DRbConnError, "too large packet #{sz}") if @load_limit < sz
- str = soc.read(sz)
+ begin
+ str = soc.read(sz)
+ rescue
+ raise(DRbConnError.new_with_error($!))
+ end
raise(DRbConnError, 'connection closed') if sz.nil?
raise(DRbConnError, 'premature marshal format(can\'t read)') if str.size < sz
begin