Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

store a separate eval_count and result_count

  • Loading branch information...
commit bcacb6f9fd30ea57434df3bcf462fd6033bf6254 1 parent 3f3e8f0
Justin Balthrop ninjudd authored

Showing 1 changed file with 8 additions and 6 deletions. Show diff stats Hide diff stats

  1. +8 6 client/ruby/portal.rb
14 client/ruby/portal.rb
@@ -21,7 +21,8 @@ def initialize(port, host = "localhost")
21 21 out.write(content)
22 22 out.flush
23 23 elsif ["result", "error", "read-error"].include?(type)
24   - context[:results][context[:count]] = [type, content]
  24 + count = context[:result_count] += 1;
  25 + context[:results][count] = [type, content]
25 26 else
26 27 raise ProtocolError, "unknown message type: #{type}"
27 28 end
@@ -50,10 +51,11 @@ def receive_message
50 51
51 52 def context(id)
52 53 @contexts[id.to_s] ||= {
53   - :results => {},
54   - :count => 0,
55   - :stdout => IO.pipe,
56   - :stderr => IO.pipe
  54 + :results => {},
  55 + :eval_count => 0,
  56 + :result_count => 0,
  57 + :stdout => IO.pipe,
  58 + :stderr => IO.pipe
57 59 }
58 60 end
59 61
@@ -67,7 +69,7 @@ def with_context(id)
67 69 def eval(form, id = @id || rand)
68 70 send_message(id, "eval", form)
69 71 context = context(id)
70   - count = context[:count] += 1;
  72 + count = context[:eval_count] += 1;
71 73 lambda do
72 74 type, form = context[:results].delete(count)
73 75 return unless type

0 comments on commit bcacb6f

Please sign in to comment.
Something went wrong with that request. Please try again.