ruined 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/ChangeLog +4 -0
  2. data/lib/ruined/ruinmain.rb +17 -8
  3. metadata +3 -3
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Thu Oct 14 20:14:00 2010 arton
2
+ * ruined/ruinmain.rb
3
+ version 0.0.5 => 0.0.7
4
+ fix caller check
1
5
  Wed Oct 13 22:39:00 2010 arton
2
6
  * ruined/ruinmain.rb
3
7
  version 0.0.5 => 0.0.6
@@ -9,7 +9,7 @@ require 'monitor'
9
9
  require 'stringio'
10
10
 
11
11
  module Ruined
12
- RUINED_VERSION = '0.0.6'
12
+ RUINED_VERSION = '0.0.7'
13
13
 
14
14
  @queue = [Queue.new, Queue.new]
15
15
  @breakpoints = []
@@ -66,7 +66,7 @@ module Ruined
66
66
  class DebugServlet < HTTPServlet::AbstractServlet
67
67
  include WEBrick::HTMLUtils
68
68
  def service(req, res)
69
- if req.addr[3] == '127.0.0.1'
69
+ if Ruined.local_call?(req.addr)
70
70
  super
71
71
  else
72
72
  bye(res)
@@ -183,6 +183,7 @@ module Ruined
183
183
  end
184
184
 
185
185
  def self.current_context
186
+ # assert @current
186
187
  @current.to_hash
187
188
  end
188
189
 
@@ -196,7 +197,7 @@ local_variables.map do |_0|
196
197
  (_0 == :_) ? nil : { :name => _0.to_s, :value => eval(_0.to_s) }
197
198
  end - [nil]
198
199
  EOD
199
- @current.binding ? eval(script, @current.binding) : []
200
+ (@current) ? eval(script, @current.binding) : []
200
201
  end
201
202
 
202
203
  def self.self_vars
@@ -209,7 +210,7 @@ self.class.class_variables.map do |v|
209
210
  { :name => v.to_s, :value => instance_eval(v.to_s) }
210
211
  end
211
212
  EOD
212
- @current.binding ? eval(script, @current.binding) : []
213
+ (@current) ? eval(script, @current.binding) : []
213
214
  end
214
215
 
215
216
  def self.global_vars
@@ -223,9 +224,11 @@ EOD
223
224
  end - [nil]
224
225
  EOD
225
226
  a = eval(script)
226
- 0.upto(a.size - 1) do |i|
227
- if @current.tlses.has_key?(a[i][:name])
228
- a[i][:value] = @current.tlses[a[i][:name]]
227
+ if @current
228
+ 0.upto(a.size - 1) do |i|
229
+ if @current.tlses.has_key?(a[i][:name])
230
+ a[i][:value] = @current.tlses[a[i][:name]]
231
+ end
229
232
  end
230
233
  end
231
234
  a
@@ -236,6 +239,7 @@ EOD
236
239
  end
237
240
 
238
241
  def self.wait(t)
242
+ return unless @queue
239
243
  logger.debug("------------wait #{t}")
240
244
  o = @queue[t].pop
241
245
  if t == 1
@@ -245,6 +249,7 @@ EOD
245
249
  end
246
250
 
247
251
  def self.release(t, obj = nil)
252
+ return unless @queue
248
253
  logger.debug("------------release #{t}")
249
254
  @monitor.synchronize {
250
255
  @queue[t].push obj
@@ -281,10 +286,14 @@ EOD
281
286
  @unbreakable_threads.include? t
282
287
  }
283
288
  end
289
+
290
+ def self.local_call?(addr)
291
+ ['127.0.0.1', '::1'].include?(addr[3])
292
+ end
284
293
 
285
294
  svr.mount('/debug', DebugServlet)
286
295
  svr.mount_proc('/quit') do |req, res|
287
- if req.addr[3] == '127.0.0.1'
296
+ if local_call?(req.addr)
288
297
  set_trace_func(nil)
289
298
  c = 0
290
299
  if req.path =~ %r|/(\d+)|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruined
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - arton