Class: VirtualModule::RpcIpcInterface
- Inherits:
-
BaseIpcInterface
- Object
- BaseIpcInterface
- VirtualModule::RpcIpcInterface
- Defined in:
- lib/virtual_module.rb
Constant Summary
Constants inherited from BaseIpcInterface
Instance Attribute Summary
Attributes inherited from BaseIpcInterface
Instance Method Summary collapse
- #call(name, *args, **kwargs) ⇒ Object
-
#initialize(provider) ⇒ RpcIpcInterface
constructor
A new instance of RpcIpcInterface.
Methods inherited from BaseIpcInterface
Constructor Details
#initialize(provider) ⇒ RpcIpcInterface
Returns a new instance of RpcIpcInterface.
621 622 623 624 625 626 627 |
# File 'lib/virtual_module.rb', line 621 def initialize(provider) super init_connection @server = "127.0.0.1" @port = 8746 @timeout = 10 end |
Instance Method Details
#call(name, *args, **kwargs) ⇒ Object
629 630 631 632 633 634 635 636 637 |
# File 'lib/virtual_module.rb', line 629 def call(name, *args, **kwargs) restart_server_process while `echo exit | telnet #{@server} #{@port} 2>&1`.chomp[-5,5]!="host." do sleep(0.05) end @client = MessagePack::RPC::Client.new(@server, @port) if @client.nil? @client.timeout = @timeout args.count>0 || kwargs.count>0 ? @client.call(name, *args, **kwargs) : @client.call(name) end |