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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbbd82c15cfd3db423e6c200ca21a1bfc34ed6d7
4
- data.tar.gz: 828f98fbc48632790ff1bb42f723e4e068c924a3
3
+ metadata.gz: af41a2e876803b7ba6d7f2515e4b47c5b26c95b6
4
+ data.tar.gz: 08094fc642b328aa339600b452b6b352b2b737b2
5
5
  SHA512:
6
- metadata.gz: 75c2287cb0aa85c1cdd66c25068a96db4f180bac1723fde3b46ad451c34afe9a7f45901c6f99b988bc5b4758e6f3fdf763b4f5b8b0ff8395b2cd7abd1c0e6e72
7
- data.tar.gz: 1a5fe36d458864aec8f45871e6d650841a47eb0d70ce22f78726eafddaf129ded96c8efd8dbf44dc6ff574b763a57112f1d2e56f895f78d884fb7f326d7daa81
6
+ metadata.gz: 8308c419c4ee8b50ea2eabba955b9f6f3574e91e0e5050ece567630da7f7b4575ee8fb4a15681056ce29e5be0b70fb3005836df5009f5846db83fdf6721e39a7
7
+ data.tar.gz: 06ff7dd4ef309311ad432995d2955bc33a2d007ec3de63567e87ae12d243997ce5ff9bac1be7cc01c51e6fd7eb2d1cca60359b67834c5cb791256903529a4921
@@ -1,5 +1,10 @@
1
1
  # ChangeLog
2
2
 
3
+ ## Version 0.2.1
4
+
5
+ - `Arachni::RPC::Client`: Updated to ensure that the `Arachni::Reactor` is
6
+ running prior to RPC operations.
7
+
3
8
  ## Version 0.2.0
4
9
 
5
10
  - Added `Arachni::Reactor`-based RPC client/server implementation.
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <table>
4
4
  <tr>
5
5
  <th>Version</th>
6
- <td>0.2.0</td>
6
+ <td>0.2.1</td>
7
7
  </tr>
8
8
  <tr>
9
9
  <th>Github page</th>
@@ -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
@@ -9,7 +9,7 @@
9
9
  module Arachni
10
10
  module RPC
11
11
 
12
- VERSION = '0.2.0'
12
+ VERSION = '0.2.1'
13
13
 
14
14
  end
15
15
  end
@@ -10,8 +10,6 @@ describe Arachni::RPC::Client do
10
10
  if Arachni::Reactor.global.running?
11
11
  Arachni::Reactor.stop
12
12
  end
13
-
14
- Arachni::Reactor.global.run_in_thread
15
13
  end
16
14
 
17
15
  let(:arguments) do
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.0
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-08-29 00:00:00.000000000 Z
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.beta2
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.beta2
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.