emdrb 0.3.0 → 0.3.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.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.3.1 / 2009-02-04
2
+ * Used EventMachine::defer instead of spawning own threads
3
+
1
4
  == 0.3.0 / 2009-01-27
2
5
 
3
6
  * Added provisions for DRb servers to have methods which are
data/README.txt CHANGED
@@ -33,6 +33,8 @@ It is, however, not yet a complete replacement for the standard DRb:
33
33
  * No SSL support. To support this fully, EventMachine needs to have
34
34
  more comprehensive SSL/TLS support.
35
35
  * RSpec tests are very basic, and need a lot more comprehensive work.
36
+ They also don't work for some reason when run under Rake, but work
37
+ just fine when run manually.
36
38
  * Many standard configuration options for DRb still unsupported
37
39
 
38
40
  These and many other problems are scheduled to be addressed in the
@@ -100,11 +102,16 @@ if you would like to run the rspec tests that are included with
100
102
  EMDRb. Daemons is not required to use EMDRb otherwise, and as such it
101
103
  is not listed as a hard dependency in the gem install.
102
104
 
105
+ If you want to install it manually, you can always download it at the
106
+ EMDRb project page at:
107
+
108
+ http://rubyforge.org/projects/emdrb
109
+
103
110
  == LICENSE:
104
111
 
105
112
  Copyright © 2008, 2009 Rafael R. Sevilla. You can redistribute it
106
113
  and/or modify it under the same terms as Ruby. Please see the file
107
114
  COPYING for more details.
108
115
 
109
- $Id: README.txt 81 2009-01-29 04:46:14Z dido $
116
+ $Id: README.txt 88 2009-02-04 04:10:52Z dido $
110
117
 
data/lib/emdrb/emdrb.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # Homepage:: http://emdrb.rubyforge.org/
5
5
  # License:: GNU General Public License / Ruby License
6
6
  #
7
- # $Id: emdrb.rb 78 2009-01-29 04:21:25Z dido $
7
+ # $Id: emdrb.rb 87 2009-02-04 04:08:06Z dido $
8
8
  #
9
9
  #----------------------------------------------------------------------------
10
10
  #
@@ -174,7 +174,6 @@ module DRb
174
174
  # The peer address for this connection.
175
175
  attr_accessor :peer_addr
176
176
 
177
-
178
177
  ##
179
178
  # The post initialization process sets up the default load
180
179
  # and argument length limits, the idconv object, the initial
@@ -209,10 +208,9 @@ module DRb
209
208
  # also further execute the method call in its own independent thread
210
209
  # and safe level invocations are also taken care of herein.
211
210
  def perform_without_block
212
- df = EventMachine::DefaultDeferrable.new
213
211
  info = Thread.current['DRb']
214
212
  req = @request
215
- Thread.new do
213
+ op = lambda do
216
214
  Thread.current['DRb'] = info
217
215
  if $SAFE < @safe_level
218
216
  $SAFE = @safe_level
@@ -221,22 +219,16 @@ module DRb
221
219
  if Proc == req[:ro] && req[:msg] == :__drb_yield
222
220
  ary = (req[:argv].size == 1) ? req[:argv] :
223
221
  [req[:argv]]
224
- EventMachine::next_tick do
225
- df.set_deferred_status(:succeeded, ary.collect(&@front)[0])
226
- end
222
+ [true, ary.collect(&@front)[0]]
227
223
  else
228
224
  r = req[:ro].__send__(req[:msg], *req[:argv])
229
- EventMachine::next_tick do
230
- df.set_deferred_status(:succeeded, r)
231
- end
225
+ [true, r]
232
226
  end
233
227
  rescue
234
- EventMachine::next_tick do
235
- df.set_deferred_status(:failed, $!)
236
- end
228
+ [false, $!]
237
229
  end
238
230
  end
239
- return(df)
231
+ return(op)
240
232
  end
241
233
 
242
234
  ##
@@ -260,10 +252,9 @@ module DRb
260
252
  # I suppose there must be a way to do it without using threads (possibly
261
253
  # by using call/cc perhaps?), but I suppose this should be okay.
262
254
  def perform_with_block
263
- df = EventMachine::DefaultDeferrable.new
264
255
  info = Thread.current['DRb']
265
256
  req = @request
266
- Thread.new do
257
+ op = lambda do
267
258
  Thread.current['DRb'] = info
268
259
  if $SAFE < @safe_level
269
260
  $SAFE = @safe_level
@@ -289,14 +280,12 @@ module DRb
289
280
  end
290
281
  block_value
291
282
  }
292
- EventMachine::next_tick { df.set_deferred_status(:succeeded, r) }
283
+ [true, r]
293
284
  rescue Exception => e
294
- EventMachine::next_tick do
295
- df.set_deferred_status(:failed, e)
296
- end
285
+ [false, e]
297
286
  end
298
287
  end
299
- return(df)
288
+ return(op)
300
289
  end
301
290
 
302
291
  ##
@@ -315,7 +304,15 @@ module DRb
315
304
  @request[:argv],
316
305
  @request[:block]))
317
306
  end
318
- return((@request[:block]) ? perform_with_block : perform_without_block)
307
+ df = EventMachine::DefaultDeferrable.new
308
+ op = (@request[:block]) ? perform_with_block : perform_without_block
309
+ callback = lambda do |res|
310
+ succ, val = res
311
+ df.set_deferred_status((succ) ? :succeeded : :failed, val)
312
+ end
313
+
314
+ EventMachine::defer(op, callback)
315
+ return(df)
319
316
  end
320
317
 
321
318
  def to_obj(ref)
data/lib/emdrb/version.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # Homepage:: http://emdrb.rubyforge.org/
5
5
  # License:: GNU Lesser General Public License / Ruby License
6
6
  #
7
- # $Id: version.rb 68 2009-01-27 07:26:59Z dido $
7
+ # $Id: version.rb 83 2009-02-04 03:39:51Z dido $
8
8
  #
9
9
  #----------------------------------------------------------------------------
10
10
  #
@@ -26,7 +26,7 @@ module EMDRb
26
26
 
27
27
  MAJOR = 0
28
28
  MINOR = 3
29
- TINY = 0
29
+ TINY = 1
30
30
 
31
31
  # The version of EMDRb in use.
32
32
  STRING = [ MAJOR, MINOR, TINY ].join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emdrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dido@imperium.ph
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-29 00:00:00 +08:00
12
+ date: 2009-02-04 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15