em-synchrony-moped 2.0.0.beta.1 → 2.0.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODA5NjIzNDY3MzZiYzk1MTU4ODRmMGE5Mjg3MjcxMWNkYzYxNzAyOA==
4
+ M2YxNzAyOGQzNGE4NWYwYTQ0ODBiNmYxNDZiNjI1YmM0NGQwMDczMg==
5
5
  data.tar.gz: !binary |-
6
- ZjM0ZTVjMTEyZmY0NWZhYTBjNTgyMTFkY2ZjNTNiODAxNmI1MjA5Yg==
6
+ Y2Y3MjAwZTI1YTJjMzdmNTNhN2M1ZDJhZTU3ZDVkMTg5ZTFhNTY5MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OGM1MWY4YTBjNzY3ZWIzMDhmZjI0ZjBhYWM4NTM1MTU2YzVhMzdkNmJlOWFj
10
- N2IzNDk1MTFiZGMyMGYyNmUwNmRlMmJkMWUwNzMwNWUyYTEyYTczNTEzNmRh
11
- YjVkNzU5YjliYzU1Zjc5OTE4YTIxMGM5M2IwZTk5NzNmYjQ0MWE=
9
+ YTU3MDgwNDVjOTFlNmM2ZmY3NjI5NmE0MTQwNWYwYzE2MDIwMmQ2ZmJhODkz
10
+ YWU3ZTgxMmNlNmMyNTUxMGYzNGFhMGIyYzdkYzIzZGZhZmYwYWEwOTFkZmUw
11
+ YWIwNTFhYjdlZGUyMDQyMjEzYTk5OTZmZGMyMTA3ZGNlYWZmN2Y=
12
12
  data.tar.gz: !binary |-
13
- OTAzYjhhMGZmMDVkZmFiMzdhNTUzMDA4ZTkwYjM4YWM4N2ZiZDFmOGViZGY3
14
- ZDQwZTNkOTAwYWVhMjNjNzM4ZDcwNTkyYmJhNGU5OWUzM2QzMmRmMzQyODgy
15
- ZDY0ZTVmNTU3MDU0NDBlMDVmODc2NTIzZmE4NDdmN2U5ODE3Yzk=
13
+ NzE0MTU3YjQwNjk4OGYwOGVmNzZkZTY1ZGU3NTkyMDdhZGNlNDVlNDc5MGU2
14
+ NzU5N2RkMTcxNzg4MGIwOGVjMzE2MzJmMDQzNTM0MmI1ZjVlNDgyOWRkZTQ0
15
+ YzNhMWYwNzk4MmNmM2FmMTdlMzdlMzZjNGUyMzQyOGJkMDA3OWQ=
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'em-synchrony-moped'
5
- s.version = "2.0.0.beta.1"
5
+ s.version = "2.0.0.beta.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Adam Lebsack"]
@@ -1,4 +1,9 @@
1
1
  # encoding: utf-8
2
+
3
+ require 'moped/address'
4
+ require 'em-dns-resolver'
5
+ require 'fiber'
6
+
2
7
  module Moped
3
8
  class Address
4
9
 
@@ -20,8 +25,6 @@ module Moped
20
25
  end
21
26
 
22
27
  def em_each_address(value)
23
- puts "em_each_address: #{value.inspect}"
24
-
25
28
  # Lookup in /etc/hosts
26
29
  result = []
27
30
  @hosts ||= Resolv::Hosts.new
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'em-synchrony'
4
+ require 'em-synchrony/moped/address'
4
5
  require 'em-synchrony/moped/cluster'
5
- require 'em-synchrony/moped/node'
6
6
  require 'em-synchrony/moped/connection'
7
- require 'em-synchrony/moped/address'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-synchrony-moped
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta.1
4
+ version: 2.0.0.beta.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Lebsack
@@ -212,7 +212,6 @@ files:
212
212
  - lib/em-synchrony/moped/address.rb
213
213
  - lib/em-synchrony/moped/cluster.rb
214
214
  - lib/em-synchrony/moped/connection.rb
215
- - lib/em-synchrony/moped/node.rb
216
215
  - spec/lib/em-synchrony/moped/cluster_spec.rb
217
216
  - spec/lib/em-synchrony/moped/connection_spec.rb
218
217
  - spec/lib/em-synchrony/moped/node_spec.rb
@@ -1,47 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'moped/node'
4
- require 'em-dns-resolver'
5
- require 'fiber'
6
-
7
- module Moped
8
- # # Our monkey patches to Moped::Node
9
- class Node
10
- if Moped::VERSION < "2.0.0"
11
- alias_method :super_parse_address, :parse_address
12
- # Override to support non-blocking DNS requests
13
- def parse_address
14
- return super_parse_address unless EventMachine.reactor_thread?
15
- host, port = address.split(':')
16
- @port = (port || 27_017).to_i
17
-
18
- @ip_address = em_lookup_address(host).grep(/(::){0}/).first
19
- fail SocketError unless @ip_address
20
- @resolved_address = "#{@ip_address}:#{@port}"
21
- rescue Resolv::ResolvError
22
- raise SocketError
23
- end
24
-
25
- def em_lookup_address(value)
26
- # Lookup in /etc/hosts
27
- result = []
28
- @hosts ||= Resolv::Hosts.new
29
- @hosts.send(:each_address, value) { |x| result << x.to_s if x !~ /::/ }
30
- return result unless result.empty?
31
-
32
- # Nothing, hit DNS
33
- fiber = Fiber.current
34
- df = EM::DnsResolver.send(:resolve, value)
35
- df.callback do |a|
36
- fiber.resume(a)
37
- end
38
- df.errback do |*a|
39
- fiber.resume(Resolv::ResolvError.new(a.inspect))
40
- end
41
- result = Fiber.yield
42
- fail result if result.is_a?(StandardError)
43
- result
44
- end
45
- end
46
- end
47
- end