arachni-rpc 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/arachni/rpc/client.rb +15 -0
- data/lib/arachni/rpc/version.rb +1 -1
- data/spec/arachni/rpc/client_spec.rb +0 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af41a2e876803b7ba6d7f2515e4b47c5b26c95b6
|
4
|
+
data.tar.gz: 08094fc642b328aa339600b452b6b352b2b737b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8308c419c4ee8b50ea2eabba955b9f6f3574e91e0e5050ece567630da7f7b4575ee8fb4a15681056ce29e5be0b70fb3005836df5009f5846db83fdf6721e39a7
|
7
|
+
data.tar.gz: 06ff7dd4ef309311ad432995d2955bc33a2d007ec3de63567e87ae12d243997ce5ff9bac1be7cc01c51e6fd7eb2d1cca60359b67834c5cb791256903529a4921
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/arachni/rpc/client.rb
CHANGED
@@ -104,6 +104,8 @@ class Client
|
|
104
104
|
# `true` if a new connection had to be established, `false` if an existing
|
105
105
|
# one was re-used.
|
106
106
|
def connect( &block )
|
107
|
+
ensure_reactor_running
|
108
|
+
|
107
109
|
if @connections.empty? && @connection_count < @pool_size
|
108
110
|
opts = @socket ? @socket : [@host, @port]
|
109
111
|
block.call @reactor.connect( *[opts, Handler, @opts.merge( client: self )].flatten )
|
@@ -131,6 +133,8 @@ class Client
|
|
131
133
|
|
132
134
|
# Close all connections.
|
133
135
|
def close
|
136
|
+
ensure_reactor_running
|
137
|
+
|
134
138
|
@reactor.on_tick do |task|
|
135
139
|
@connections.pop(&:close_without_retry)
|
136
140
|
task.done if @connections.empty?
|
@@ -145,6 +149,8 @@ class Client
|
|
145
149
|
#
|
146
150
|
# @param [Handler] connection
|
147
151
|
def push_connection( connection )
|
152
|
+
ensure_reactor_running
|
153
|
+
|
148
154
|
@connections << connection
|
149
155
|
end
|
150
156
|
|
@@ -152,6 +158,8 @@ class Client
|
|
152
158
|
#
|
153
159
|
# @param [Handler] connection
|
154
160
|
def connection_failed( connection )
|
161
|
+
ensure_reactor_running
|
162
|
+
|
155
163
|
@connection_count -= 1
|
156
164
|
connection.close_without_retry
|
157
165
|
end
|
@@ -176,6 +184,8 @@ class Client
|
|
176
184
|
# Collection of arguments to be passed to the method.
|
177
185
|
# @param [Block] block
|
178
186
|
def call( msg, *args, &block )
|
187
|
+
ensure_reactor_running
|
188
|
+
|
179
189
|
req = Request.new(
|
180
190
|
message: msg,
|
181
191
|
args: args,
|
@@ -230,6 +240,11 @@ class Client
|
|
230
240
|
ret
|
231
241
|
end
|
232
242
|
|
243
|
+
def ensure_reactor_running
|
244
|
+
return if @reactor.running?
|
245
|
+
@reactor.run_in_thread
|
246
|
+
end
|
247
|
+
|
233
248
|
end
|
234
249
|
|
235
250
|
end
|
data/lib/arachni/rpc/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arachni-rpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tasos Laskos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arachni-reactor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.0.
|
19
|
+
version: 0.1.0.beta4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.0.
|
26
|
+
version: 0.1.0.beta4
|
27
27
|
description: |2
|
28
28
|
Arachni::RPC is a simple and lightweight Remote Procedure Call protocol
|
29
29
|
used to provide the basis for Arachni's distributed infrastructure.
|