distributor 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  require "distributor"
2
2
  require "distributor/okjson"
3
3
  require "distributor/packet"
4
+ require "thread"
4
5
 
5
6
  class Distributor::Multiplexer
6
7
 
@@ -8,6 +9,7 @@ class Distributor::Multiplexer
8
9
  @output = output
9
10
  @readers = {}
10
11
  @writers = {}
12
+ @write_lock = Mutex.new
11
13
 
12
14
  @output.sync = true
13
15
  end
@@ -36,7 +38,9 @@ class Distributor::Multiplexer
36
38
  end
37
39
 
38
40
  def output(ch, data)
39
- Distributor::Packet.write(@output, ch, data)
41
+ @write_lock.synchronize do
42
+ Distributor::Packet.write(@output, ch, data)
43
+ end
40
44
  rescue Errno::EPIPE
41
45
  end
42
46
 
@@ -1,5 +1,5 @@
1
1
  module Distributor
2
2
 
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
 
5
5
  end
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.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70221318635160 !ruby/object:Gem::Requirement
16
+ requirement: &70176922154520 !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: *70221318635160
24
+ version_requirements: *70176922154520
25
25
  description: TCP Multiplexer
26
26
  email: ddollar@gmail.com
27
27
  executables: []