Class: DRb::DRbMessage
- Inherits:
-
Object
- Object
- DRb::DRbMessage
- Defined in:
- lib/VMwareWebService/DMiqVimSync.rb
Overview
module DMiqVimSync
Constant Summary collapse
- EXPECTED_MARSHAL_VERSION =
[Marshal::MAJOR_VERSION, Marshal::MINOR_VERSION].freeze
Instance Method Summary collapse
-
#dump(obj, error = false) ⇒ Object
This is the DRB half of the dupObj locking scheme.
- #dump_original ⇒ Object
Instance Method Details
#dump(obj, error = false) ⇒ Object
This is the DRB half of the dupObj locking scheme. If we get a MiqDrbReturn object, we marshal the object it wraps and release the lock.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/VMwareWebService/DMiqVimSync.rb', line 30 def dump(obj, error = false) # # Place a temp hold on the object until the client registers it. # obj.holdBrokerObj if obj.respond_to?(:holdBrokerObj) obj_to_dump = obj.kind_of?(MiqDrbReturn) ? obj.obj : obj result = dump_original(obj_to_dump, error) valid = true size = result[0..3].unpack("N")[0] if @load_limit < size $vim_log.error("DRb packet size too large: #{size}") valid = false end marshal_version = result[4, 2].unpack("C2") if marshal_version != EXPECTED_MARSHAL_VERSION $vim_log.error("Marshal version mismatch: expected: #{EXPECTED_MARSHAL_VERSION} got: #{marshal_version}") valid = false end unless valid $vim_log.error("object: #{obj.inspect}") $vim_log.error("buffer:\n#{result[0, 1024].hex_dump}") $vim_log.error("caller:\n#{caller.join("\n")}") end return result unless obj.kind_of?(MiqDrbReturn) begin return result ensure if obj.lock && obj.lock.sync_locked? $vim_log.debug "DRb::DRbMessage.dump: UNLOCKING [#{Thread.current.object_id}] <#{obj.obj.object_id}>" if $vim_log.debug? obj.lock.sync_unlock end end end |
#dump_original ⇒ Object
24 |
# File 'lib/VMwareWebService/DMiqVimSync.rb', line 24 alias_method :dump_original, :dump |