Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby27/share/ruby/drb
File: weakidconv.rb
# frozen_string_literal: false
[0] Fix | Delete
require_relative 'drb'
[1] Fix | Delete
require 'monitor'
[2] Fix | Delete
[3] Fix | Delete
module DRb
[4] Fix | Delete
[5] Fix | Delete
# To use WeakIdConv:
[6] Fix | Delete
#
[7] Fix | Delete
# DRb.start_service(nil, nil, {:idconv => DRb::WeakIdConv.new})
[8] Fix | Delete
[9] Fix | Delete
class WeakIdConv < DRbIdConv
[10] Fix | Delete
class WeakSet
[11] Fix | Delete
include MonitorMixin
[12] Fix | Delete
def initialize
[13] Fix | Delete
super()
[14] Fix | Delete
@immutable = {}
[15] Fix | Delete
@map = ObjectSpace::WeakMap.new
[16] Fix | Delete
end
[17] Fix | Delete
[18] Fix | Delete
def add(obj)
[19] Fix | Delete
synchronize do
[20] Fix | Delete
begin
[21] Fix | Delete
@map[obj] = self
[22] Fix | Delete
rescue ArgumentError
[23] Fix | Delete
@immutable[obj.__id__] = obj
[24] Fix | Delete
end
[25] Fix | Delete
return obj.__id__
[26] Fix | Delete
end
[27] Fix | Delete
end
[28] Fix | Delete
[29] Fix | Delete
def fetch(ref)
[30] Fix | Delete
synchronize do
[31] Fix | Delete
@immutable.fetch(ref) {
[32] Fix | Delete
@map.each { |key, _|
[33] Fix | Delete
return key if key.__id__ == ref
[34] Fix | Delete
}
[35] Fix | Delete
raise RangeError.new("invalid reference")
[36] Fix | Delete
}
[37] Fix | Delete
end
[38] Fix | Delete
end
[39] Fix | Delete
end
[40] Fix | Delete
[41] Fix | Delete
def initialize()
[42] Fix | Delete
super()
[43] Fix | Delete
@weak_set = WeakSet.new
[44] Fix | Delete
end
[45] Fix | Delete
[46] Fix | Delete
def to_obj(ref) # :nodoc:
[47] Fix | Delete
return super if ref.nil?
[48] Fix | Delete
@weak_set.fetch(ref)
[49] Fix | Delete
end
[50] Fix | Delete
[51] Fix | Delete
def to_id(obj) # :nodoc:
[52] Fix | Delete
return @weak_set.add(obj)
[53] Fix | Delete
end
[54] Fix | Delete
end
[55] Fix | Delete
end
[56] Fix | Delete
[57] Fix | Delete
# DRb.install_id_conv(WeakIdConv.new)
[58] Fix | Delete
[59] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function