wampus 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1344ac9b431935be7e6eb17811b05b32553b216f
4
- data.tar.gz: 4f0633e43c52ca041dadd7f77f54a8b99233b506
3
+ metadata.gz: 1fab89846514435d31da67a8901ff932dfb5f00f
4
+ data.tar.gz: 7860fa6dafa8ac71cef8d93c006c8218d18507fd
5
5
  SHA512:
6
- metadata.gz: 2049c1ac5788a583a73b0441cb87c0b4986dc2824bc42b767e3bd0cfe65e5872c92cfcab6b5293635adfec7f4e71407519344dea0bb2365225052afd96020b38
7
- data.tar.gz: 33e317dd4d990ef424176be6207cf89f83fce62574c810e14433139f3b0b2f0eabf566ede047e5c6d4ef55ceb7039282ca67a0389014ed6ce8eaa441c8af6c78
6
+ metadata.gz: baf0b7adcfb7a01b95121e07f0983de9871087fb20e6774536cd2d2cbe02dc6bc532faabadd8f75ee0eb45dc07fc41ff8b5f85d4be147d70c54babbe503035db
7
+ data.tar.gz: 8d69e07b83649147a4f5faa415c349a2839b1e1b0fc70f0c57d55b3eff470802cabc05ee6a161a03d3c05f863a163b3706a5b9432d91b5d6df154101ac01b6df
@@ -168,14 +168,14 @@ module Wampus
168
168
 
169
169
  def get_subscribe_handler(topic_uri)
170
170
  topic = topic_for_uri topic_uri
171
- nil unless topic
171
+ return nil unless topic
172
172
  handler = topic.subscribe_handler
173
173
  [topic.uri, topic_uri[topic.uri.length..-1], *handler]
174
174
  end
175
175
 
176
176
  def get_publish_handler(topic_uri)
177
177
  topic = topic_for_uri topic_uri
178
- nil unless topic
178
+ return nil unless topic
179
179
  handler = topic.publish_handler
180
180
  [topic.uri, topic_uri[topic.uri.length..-1], *handler]
181
181
  end
@@ -40,7 +40,6 @@ module Wampus
40
40
  end
41
41
  end
42
42
 
43
- # TODO FIXME Use EM Deferred
44
43
  def handle_call_msg(connection, data)
45
44
  call_id, proc_uri, *args = data
46
45
 
@@ -53,19 +52,20 @@ module Wampus
53
52
  raise Wampus::Errors::CallError.new(Wampus::Protocols::Wamp::URI_ERROR+'NoSuchRPCEndpoint', 'Missing Method')
54
53
  end
55
54
 
56
- EM.defer lambda {
57
- run_rpc_deferred connection, handler, args
58
- }, lambda { |result|
59
- if result.is_a? StandardError
60
- error = on_after_call_error connection, result
61
- msg = call_error_msg call_id, *error.to_call_error
62
- connection.write msg
63
- on_after_send_call_error connection, msg
64
- else
65
- result = on_after_call_success connection, result
66
- connection.write call_result_msg call_id, result
55
+ begin
56
+ if handler[0]
57
+ result = handler[0].send handler[1], connection, *args
58
+ elsif handler[1].is_a? Proc
59
+ result = handler[1].call connection, *args
67
60
  end
68
- }
61
+ result = on_after_call_success connection, result
62
+ connection.write call_result_msg call_id, result
63
+ rescue => error
64
+ error = on_after_call_error connection, error
65
+ msg = call_error_msg call_id, *error.to_call_error
66
+ connection.write msg
67
+ on_after_send_call_error connection, msg
68
+ end
69
69
  end
70
70
 
71
71
  # -- RPC Hooks
@@ -80,7 +80,7 @@ module Wampus
80
80
 
81
81
  def on_after_call_error(connection, error)
82
82
  unless error.is_a? Wampus::Errors::CallError
83
- error = Wampus::Errors::CallError.new(Wampus::Protocols::Wamp::URI_ERROR+'generic', 'RPC Call Error')
83
+ error = Wampus::Errors::CallError.new(Wampus::Protocols::Wamp::URI_ERROR+'generic', "RPC Call Error: #{error.message}")
84
84
  end
85
85
  error
86
86
  end
@@ -13,6 +13,7 @@ module Wampus
13
13
  end
14
14
 
15
15
  def run(options = {})
16
+ # Maybe we'll get subprotocol support in EM::Websocket one day
16
17
  options[:protocol] ||= ['wamp']
17
18
  options['sec-websocket-protocol'] = 'wamp'
18
19
  EM::WebSocket.run(options) do |ws|
@@ -1,3 +1,3 @@
1
1
  module Wampus
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wampus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Stack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-15 00:00:00.000000000 Z
11
+ date: 2013-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.1.10
132
+ rubygems_version: 2.1.11
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: ''