Class: DRb::HTTP0::ServerSide

Inherits:
Object
  • Object
show all
Defined in:
lib/drb/http0serv.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callback, config) ⇒ ServerSide

Returns a new instance of ServerSide.



91
92
93
94
95
96
97
# File 'lib/drb/http0serv.rb', line 91

def initialize(callback, config)
  @callback = callback
  @config = config
  @msg = DRbMessage.new(@config)
  @req_stream = StrStream.new(@callback.req_body)
  @uri = @callback.uri
end

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



89
90
91
# File 'lib/drb/http0serv.rb', line 89

def uri
  @uri
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


104
# File 'lib/drb/http0serv.rb', line 104

def alive?; false; end

#closeObject



99
100
101
102
# File 'lib/drb/http0serv.rb', line 99

def close
  @callback.close if @callback
  @callback = nil
end

#recv_requestObject



106
107
108
109
110
111
112
113
# File 'lib/drb/http0serv.rb', line 106

def recv_request
  begin
    @msg.recv_request(@req_stream)
  rescue
    close
    raise $!
  end
end

#send_reply(succ, result) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
# File 'lib/drb/http0serv.rb', line 115

def send_reply(succ, result)
  begin
    return unless @callback
    stream = StrStream.new
    @msg.send_reply(stream, succ, result)
    @callback.reply(stream.buf)
  rescue
    close
    raise $!
  end
end