Guest User

Untitled

a guest
Dec 13th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. access-log: /dev/null
  2. hosts:
  3. "localhost":
  4. listen: 8384
  5. paths:
  6. "/t":
  7. mruby.handler: |
  8. class Foo
  9. def initialize(ch, a)
  10. @ch = ch
  11. task do
  12. @ch.push a
  13. end
  14. end
  15. end
  16. Proc.new do |env|
  17. begin
  18. ch = H2O::Channel.new
  19. f1 = Foo.new(ch, "a")
  20. f2 = Foo.new(ch, "b")
  21. str = ''
  22. 2.times{ str << ch.shift }
  23. [200, {}, [str]]
  24. rescue => e
  25. puts "Unexpected error #{e.class}:#{e.message}"
  26. e.backtrace.each do |bt|
  27. puts "\t#{bt}"
  28. end
  29. [500, {}, [e.message]]
  30. end
  31. end
Add Comment
Please, Sign In to add comment