dripdrop 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/dripdrop.gemspec +4 -1
- data/example/pubsub.rb +2 -1
- data/lib/dripdrop/node.rb +12 -1
- metadata +18 -4
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/dripdrop.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dripdrop}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.8.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Cholakian"]
|
@@ -91,6 +91,7 @@ Gem::Specification.new do |s|
|
|
91
91
|
s.add_runtime_dependency(%q<zmqmachine>, [">= 0"])
|
92
92
|
s.add_runtime_dependency(%q<msgpack>, [">= 0"])
|
93
93
|
s.add_runtime_dependency(%q<json>, [">= 0"])
|
94
|
+
s.add_runtime_dependency(%q<em-resolv-replace>, [">= 0"])
|
94
95
|
else
|
95
96
|
s.add_dependency(%q<ffi-rzmq>, [">= 0"])
|
96
97
|
s.add_dependency(%q<eventmachine>, [">= 0"])
|
@@ -99,6 +100,7 @@ Gem::Specification.new do |s|
|
|
99
100
|
s.add_dependency(%q<zmqmachine>, [">= 0"])
|
100
101
|
s.add_dependency(%q<msgpack>, [">= 0"])
|
101
102
|
s.add_dependency(%q<json>, [">= 0"])
|
103
|
+
s.add_dependency(%q<em-resolv-replace>, [">= 0"])
|
102
104
|
end
|
103
105
|
else
|
104
106
|
s.add_dependency(%q<ffi-rzmq>, [">= 0"])
|
@@ -108,6 +110,7 @@ Gem::Specification.new do |s|
|
|
108
110
|
s.add_dependency(%q<zmqmachine>, [">= 0"])
|
109
111
|
s.add_dependency(%q<msgpack>, [">= 0"])
|
110
112
|
s.add_dependency(%q<json>, [">= 0"])
|
113
|
+
s.add_dependency(%q<em-resolv-replace>, [">= 0"])
|
111
114
|
end
|
112
115
|
end
|
113
116
|
|
data/example/pubsub.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'dripdrop/node'
|
2
3
|
Thread.abort_on_exception = true
|
3
4
|
|
4
5
|
#Define our handlers
|
5
6
|
DripDrop::Node.new do
|
6
|
-
route :pub, :zmq_publish, 'tcp://
|
7
|
+
route :pub, :zmq_publish, 'tcp://localhost:2200', :bind
|
7
8
|
route :sub1, :zmq_subscribe, pub.address, :connect, :topic_filter => /[13579]$/
|
8
9
|
route :sub2, :zmq_subscribe, pub.address, :connect, :topic_filter => /[02468]$/
|
9
10
|
route :sub3, :zmq_subscribe, pub.address, :connect
|
data/lib/dripdrop/node.rb
CHANGED
@@ -3,6 +3,8 @@ require 'ffi-rzmq'
|
|
3
3
|
require 'zmqmachine'
|
4
4
|
require 'eventmachine'
|
5
5
|
require 'uri'
|
6
|
+
require 'resolv'
|
7
|
+
require 'ipaddr'
|
6
8
|
|
7
9
|
require 'dripdrop/message'
|
8
10
|
require 'dripdrop/node/nodelet'
|
@@ -11,6 +13,10 @@ require 'dripdrop/handlers/zeromq'
|
|
11
13
|
require 'dripdrop/handlers/websockets'
|
12
14
|
require 'dripdrop/handlers/http'
|
13
15
|
|
16
|
+
if defined?(Fiber)
|
17
|
+
require 'em-resolv-replace'
|
18
|
+
end
|
19
|
+
|
14
20
|
class DripDrop
|
15
21
|
class Node
|
16
22
|
attr_reader :zm_reactor, :routing, :nodelets
|
@@ -276,7 +282,12 @@ class DripDrop
|
|
276
282
|
|
277
283
|
def zmq_handler(klass, zm_sock_type, address, socket_ctype, opts={})
|
278
284
|
addr_uri = URI.parse(address)
|
279
|
-
|
285
|
+
|
286
|
+
host = Resolv.getaddresses(addr_uri.host).first
|
287
|
+
host_addr = Resolv.getaddresses('localhost').map {|a| IPAddr.new(a)}.find {|a| a.ipv4?}
|
288
|
+
host_str = host_addr.ipv6? ? "[#{host_addr.to_s}]" : host_addr.to_s
|
289
|
+
|
290
|
+
zm_addr = ZM::Address.new(host_str,addr_uri.port.to_i,addr_uri.scheme.to_sym)
|
280
291
|
h_opts = handler_opts_given(opts)
|
281
292
|
handler = klass.new(zm_addr,@zm_reactor,socket_ctype,h_opts)
|
282
293
|
@zm_reactor.send(zm_sock_type,handler)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dripdrop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 0.8.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Cholakian
|
@@ -116,6 +116,20 @@ dependencies:
|
|
116
116
|
version: "0"
|
117
117
|
type: :runtime
|
118
118
|
version_requirements: *id007
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: em-resolv-replace
|
121
|
+
prerelease: false
|
122
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 3
|
128
|
+
segments:
|
129
|
+
- 0
|
130
|
+
version: "0"
|
131
|
+
type: :runtime
|
132
|
+
version_requirements: *id008
|
119
133
|
description: "Evented framework for ZeroMQ and EventMachine Apps. "
|
120
134
|
email: andrew@andrewvc.com
|
121
135
|
executables: []
|