pingpongpear 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ping_pong_pear.rb +17 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59d1e06b1237bfe9eb504c6a8ea597d5129de5ea
|
4
|
+
data.tar.gz: 4f1ea5538b22476adab3b709791a979e29381fa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f8f93661c838750a24f45661386897e57d460f0dff3247c12c7e3e455ed4e09d95d7475687b7fa409e672508b72ecb9d6aaffde63e5fb7ea1392a1a37ca4749
|
7
|
+
data.tar.gz: d41b22097d6cbeb2d862baaba5083a8e01b48d930654699119cf836df056ed6afb27a87bb0db93def074a82d740e69ef4f075343f610ccbd15aa9587f8368634
|
data/lib/ping_pong_pear.rb
CHANGED
@@ -7,7 +7,7 @@ require 'logger'
|
|
7
7
|
require 'shellwords'
|
8
8
|
|
9
9
|
class PingPongPear
|
10
|
-
VERSION = '2.0.
|
10
|
+
VERSION = '2.0.2'
|
11
11
|
|
12
12
|
SERVICE = "_http._tcp,pingpongpear"
|
13
13
|
|
@@ -25,7 +25,7 @@ class PingPongPear
|
|
25
25
|
|
26
26
|
def initialize
|
27
27
|
@pull_requests = Queue.new
|
28
|
-
@send_pull_requests =
|
28
|
+
@send_pull_requests = []
|
29
29
|
@peers = Set.new
|
30
30
|
@logger = Logger.new $stdout
|
31
31
|
end
|
@@ -69,9 +69,12 @@ kill -INFO $(cat #{pidfile})
|
|
69
69
|
|
70
70
|
discover identifier, name, peers
|
71
71
|
process_pull_requests pull_requests
|
72
|
-
process_send_pull_requests @send_pull_requests
|
72
|
+
t = process_send_pull_requests @send_pull_requests
|
73
73
|
|
74
|
-
trap('INFO') {
|
74
|
+
trap('INFO') {
|
75
|
+
send_pull_requests peers, hostname, http_port
|
76
|
+
t.wakeup
|
77
|
+
}
|
75
78
|
|
76
79
|
advertise(identifier, name, hostname, http_port).each { |x| x }
|
77
80
|
end
|
@@ -143,12 +146,16 @@ kill -INFO $(cat #{pidfile})
|
|
143
146
|
|
144
147
|
def process_send_pull_requests requests
|
145
148
|
Thread.new do
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
149
|
+
loop do
|
150
|
+
requests.each do |pr|
|
151
|
+
host, port, http_host, http_port = *pr
|
152
|
+
http = Net::HTTP.new host, port
|
153
|
+
request = Net::HTTP::Post.new '/pull'
|
154
|
+
request.set_form_data 'host' => http_host, 'port' => http_port
|
155
|
+
http.request request
|
156
|
+
end
|
157
|
+
requests.clear
|
158
|
+
Thread.stop
|
152
159
|
end
|
153
160
|
end
|
154
161
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pingpongpear
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03
|
11
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dnssd
|