distributor 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/distributor/multiplexer.rb +1 -5
- data/lib/distributor/packet.rb +11 -9
- data/lib/distributor/version.rb +1 -1
- metadata +3 -3
@@ -1,7 +1,6 @@
|
|
1
1
|
require "distributor"
|
2
2
|
require "distributor/okjson"
|
3
3
|
require "distributor/packet"
|
4
|
-
require "thread"
|
5
4
|
|
6
5
|
class Distributor::Multiplexer
|
7
6
|
|
@@ -9,7 +8,6 @@ class Distributor::Multiplexer
|
|
9
8
|
@output = output
|
10
9
|
@readers = Hash.new { |hash,key| hash[key] = StringIO.new }
|
11
10
|
@writers = Hash.new { |hash,key| hash[key] = StringIO.new }
|
12
|
-
@write_lock = Mutex.new
|
13
11
|
|
14
12
|
@output.sync = true
|
15
13
|
end
|
@@ -38,9 +36,7 @@ class Distributor::Multiplexer
|
|
38
36
|
end
|
39
37
|
|
40
38
|
def output(ch, data)
|
41
|
-
@
|
42
|
-
Distributor::Packet.write(@output, ch, data)
|
43
|
-
end
|
39
|
+
Distributor::Packet.write(@output, ch, data)
|
44
40
|
rescue Errno::EPIPE
|
45
41
|
end
|
46
42
|
|
data/lib/distributor/packet.rb
CHANGED
@@ -20,15 +20,17 @@ class Distributor::Packet
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.parse(io)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
23
|
+
@@input ||= Mutex.new
|
24
|
+
@@input.synchronize do
|
25
|
+
header = io.read(4)
|
26
|
+
return if header.nil?
|
27
|
+
raise "invalid header" unless header == "DIST"
|
28
|
+
version = unpack(io.read(4))
|
29
|
+
channel = unpack(io.read(4))
|
30
|
+
length = unpack(io.read(4))
|
31
|
+
data = io.read(length)
|
32
|
+
return [ channel, data ]
|
33
|
+
end
|
32
34
|
end
|
33
35
|
|
34
36
|
def self.pack(num)
|
data/lib/distributor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: distributor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70284552374260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.13.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70284552374260
|
25
25
|
description: TCP Multiplexer
|
26
26
|
email: ddollar@gmail.com
|
27
27
|
executables: []
|