angelo 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +6 -0
- data/lib/angelo/stash.rb +3 -5
- data/lib/angelo/version.rb +1 -1
- data/test/angelo/stash_spec.rb +49 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6587b907b0623b8cc15e44cd6b8bcbe13f74457f
|
|
4
|
+
data.tar.gz: 7a1f799676dd2aaedc0bc5f2752849ca2edb3b91
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bfaa807fa0ec7facc7475b5d6af7e476138396dccf06607705a27996a19109ebffbdbdc1b308f0f429a2bad7b5bba015301ab9c8c76336a1a944565f9a89c634
|
|
7
|
+
data.tar.gz: 1913737e3cda415a6741215f6d65a0a54a0247f74bbc7cae1dd55974e95d40983dca9a8d933baa028a8f7f0c44297346104328ad2e790e0915567079afe70d29
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/angelo/stash.rb
CHANGED
|
@@ -38,7 +38,6 @@ module Angelo
|
|
|
38
38
|
#
|
|
39
39
|
def << s
|
|
40
40
|
peeraddrs[s] = s.peeraddr
|
|
41
|
-
yield if block_given?
|
|
42
41
|
stashes[@context] << s
|
|
43
42
|
end
|
|
44
43
|
|
|
@@ -52,7 +51,7 @@ module Angelo
|
|
|
52
51
|
# as needed
|
|
53
52
|
#
|
|
54
53
|
def each &block
|
|
55
|
-
stash.each do |s|
|
|
54
|
+
stash.dup.each do |s|
|
|
56
55
|
begin
|
|
57
56
|
yield s
|
|
58
57
|
rescue Reel::SocketError, IOError, SystemCallError => e
|
|
@@ -118,9 +117,8 @@ module Angelo
|
|
|
118
117
|
include Stash
|
|
119
118
|
|
|
120
119
|
def << ws
|
|
121
|
-
super
|
|
122
|
-
|
|
123
|
-
end
|
|
120
|
+
super
|
|
121
|
+
@server.async.handle_websocket ws
|
|
124
122
|
end
|
|
125
123
|
|
|
126
124
|
end
|
data/lib/angelo/version.rb
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require_relative '../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Angelo::Stash do
|
|
4
|
+
|
|
5
|
+
describe 'error handling' do
|
|
6
|
+
|
|
7
|
+
class ErrorSocket
|
|
8
|
+
|
|
9
|
+
def read *args
|
|
10
|
+
raise IOError
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def closed?
|
|
14
|
+
true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class TestStash
|
|
20
|
+
extend Angelo::Stash::ClassMethods
|
|
21
|
+
include Angelo::Stash
|
|
22
|
+
|
|
23
|
+
def << s
|
|
24
|
+
peeraddrs[s] = [nil, 'hi from tests']
|
|
25
|
+
stashes[@context] << s
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'does not skip live sockets when removing dead sockets' do
|
|
31
|
+
err_sock = ErrorSocket.new
|
|
32
|
+
|
|
33
|
+
good_sock = Minitest::Mock.new
|
|
34
|
+
good_sock.expect :read, "hi"
|
|
35
|
+
good_sock.expect :hash, 123
|
|
36
|
+
def good_sock.== o; o == self; end
|
|
37
|
+
|
|
38
|
+
stash = TestStash.new nil
|
|
39
|
+
|
|
40
|
+
stash << err_sock
|
|
41
|
+
stash << good_sock
|
|
42
|
+
|
|
43
|
+
stash.each {|s| s.read}
|
|
44
|
+
good_sock.verify
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: angelo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kenichi Nakamura
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-10-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: reel
|
|
@@ -72,6 +72,7 @@ files:
|
|
|
72
72
|
- test/angelo/filter_spec.rb
|
|
73
73
|
- test/angelo/mustermann_spec.rb
|
|
74
74
|
- test/angelo/params_spec.rb
|
|
75
|
+
- test/angelo/stash_spec.rb
|
|
75
76
|
- test/angelo/static_spec.rb
|
|
76
77
|
- test/angelo/websocket_spec.rb
|
|
77
78
|
- test/angelo_spec.rb
|