Module: DRb::DRbClientProtocol

Includes:
DRbProtocolCommon
Defined in:
lib/emdrb/emdrb.rb

Overview

Client protocol module

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DRbProtocolCommon

#dump, #make_proxy, #obj_load, #receive_data_raw

Instance Attribute Details

#argsObject

Returns the value of attribute args.



769
770
771
# File 'lib/emdrb/emdrb.rb', line 769

def args
  @args
end

#blockObject

Returns the value of attribute block.



770
771
772
# File 'lib/emdrb/emdrb.rb', line 770

def block
  @block
end

#dfObject

Returns the value of attribute df.



771
772
773
# File 'lib/emdrb/emdrb.rb', line 771

def df
  @df
end

#msg_idObject

Returns the value of attribute msg_id.



768
769
770
# File 'lib/emdrb/emdrb.rb', line 768

def msg_id
  @msg_id
end

#refObject

Returns the value of attribute ref.



767
768
769
# File 'lib/emdrb/emdrb.rb', line 767

def ref
  @ref
end

Instance Method Details

#connection_completedObject



779
780
781
782
783
784
785
# File 'lib/emdrb/emdrb.rb', line 779

def connection_completed
  @connected = true
  send_request(@ref, @msg_id, @args, @block)
  @state = :succ
  @succ = nil
  @result = nil
end

#post_initObject



773
774
775
776
777
# File 'lib/emdrb/emdrb.rb', line 773

def post_init
  @msgbuffer = ""
  @idconv = DRbIdConv.new
  @load_limit = DEFAULT_LOAD_LIMIT
end

#receive_data(data) ⇒ Object



811
812
813
# File 'lib/emdrb/emdrb.rb', line 811

def receive_data(data)
  return(receive_data_raw(data))
end

#receive_obj(obj) ⇒ Object



799
800
801
802
803
804
805
806
807
808
809
# File 'lib/emdrb/emdrb.rb', line 799

def receive_obj(obj)
  if @state == :succ
    @succ = obj
    @state = :result
  else
    @result = obj
    @state = :succ
    @succ ? @df.succeed(@result) : @df.fail(@result)
    close_connection
  end
end

#send_request(ref, msgid, arg, block) ⇒ Object



787
788
789
790
791
792
793
794
795
796
797
# File 'lib/emdrb/emdrb.rb', line 787

def send_request(ref, msgid, arg, block)
  ary = []
  ary.push(dump(ref.__drbref))
  ary.push(dump(msg_id.id2name))
  ary.push(dump(arg.length))
  arg.each do |e|
	ary.push(dump(e))
  end
  ary.push(dump(block))
  send_data(ary.join(''))
end