celluloid-io 0.17.2 → 0.17.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGES.md +35 -0
- data/lib/celluloid/io.rb +1 -0
- data/lib/celluloid/io/reactor.rb +1 -1
- data/lib/celluloid/io/socket.rb +80 -0
- data/lib/celluloid/io/ssl_server.rb +1 -4
- data/lib/celluloid/io/ssl_socket.rb +6 -13
- data/lib/celluloid/io/stream.rb +4 -3
- data/lib/celluloid/io/tcp_server.rb +30 -15
- data/lib/celluloid/io/tcp_socket.rb +66 -44
- data/lib/celluloid/io/udp_socket.rb +24 -9
- data/lib/celluloid/io/unix_server.rb +25 -17
- data/lib/celluloid/io/unix_socket.rb +6 -14
- data/lib/celluloid/io/version.rb +1 -1
- data/spec/celluloid/io/actor_spec.rb +54 -1
- data/spec/celluloid/io/socket_spec.rb +173 -0
- data/spec/celluloid/io/tcp_server_spec.rb +27 -0
- data/spec/celluloid/io/tcp_socket_spec.rb +14 -0
- data/spec/celluloid/io/unix_socket_spec.rb +31 -2
- metadata +80 -44
@@ -181,6 +181,20 @@ RSpec.describe Celluloid::IO::TCPSocket, library: :IO do
|
|
181
181
|
end
|
182
182
|
end
|
183
183
|
end
|
184
|
+
|
185
|
+
context "close" do
|
186
|
+
|
187
|
+
it "flushes remaining data" do
|
188
|
+
with_connected_sockets(example_port) do |subject, peer|
|
189
|
+
subject.sync = false
|
190
|
+
within_io_actor { subject << payload }
|
191
|
+
expect{ peer.read_nonblock payload.length }.to raise_exception ::IO::WaitReadable
|
192
|
+
within_io_actor { subject.close }
|
193
|
+
expect(peer.read).to eq payload
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
184
198
|
end
|
185
199
|
|
186
200
|
context "outside Celluloid::IO" do
|
@@ -102,7 +102,7 @@ RSpec.describe Celluloid::IO::UNIXSocket, library: :IO do
|
|
102
102
|
|
103
103
|
context "eof?" do
|
104
104
|
it "blocks actor then returns by close" do
|
105
|
-
|
105
|
+
with_connected_unix_sockets do |subject, peer|
|
106
106
|
started_at = Time.now
|
107
107
|
Thread.new { sleep 0.5; peer.close; }
|
108
108
|
within_io_actor { subject.eof? }
|
@@ -112,7 +112,7 @@ RSpec.describe Celluloid::IO::UNIXSocket, library: :IO do
|
|
112
112
|
|
113
113
|
it "blocks until gets the next byte" do
|
114
114
|
allow(logger).to receive(:crash).with("Actor crashed!", Celluloid::TaskTimeout)
|
115
|
-
|
115
|
+
with_connected_unix_sockets do |subject, peer|
|
116
116
|
peer << 0x00
|
117
117
|
peer.flush
|
118
118
|
expect do
|
@@ -171,4 +171,33 @@ RSpec.describe Celluloid::IO::UNIXSocket, library: :IO do
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
end
|
174
|
+
|
175
|
+
context 'puts' do
|
176
|
+
it 'uses the write buffer' do
|
177
|
+
with_connected_unix_sockets do |subject, peer|
|
178
|
+
subject.sync = false
|
179
|
+
subject << "a"
|
180
|
+
subject.puts "b"
|
181
|
+
subject << "c"
|
182
|
+
subject.flush
|
183
|
+
subject.close
|
184
|
+
expect(peer.read).to eq "ab\nc"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
context 'readline' do
|
190
|
+
it 'uses the read buffer' do
|
191
|
+
with_connected_unix_sockets do |subject, peer|
|
192
|
+
peer << "xline one\nline two\n"
|
193
|
+
subject.getc # read one character to fill buffer
|
194
|
+
Timeout::timeout(1){
|
195
|
+
# this will block if the buffer is not used
|
196
|
+
expect(subject.readline).to eq "line one\n"
|
197
|
+
expect(subject.readline).to eq "line two\n"
|
198
|
+
}
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
174
203
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celluloid-io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.
|
4
|
+
version: 0.17.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
@@ -9,288 +9,302 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
|
-
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: nenv
|
30
|
-
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
|
-
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: dotenv
|
44
|
-
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
|
-
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: benchmark_suite
|
58
|
-
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
|
-
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rubocop
|
72
|
-
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: transpec
|
86
|
-
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
|
-
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: pry
|
100
|
-
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
|
-
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: rake
|
114
|
-
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
|
-
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: rspec
|
128
|
-
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
|
-
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: guard-rspec
|
142
|
-
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0'
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
|
-
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
151
|
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: rspec-retry
|
156
|
-
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
158
|
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0'
|
161
161
|
type: :development
|
162
162
|
prerelease: false
|
163
|
-
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: coveralls
|
170
|
-
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
172
|
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
175
|
type: :development
|
176
176
|
prerelease: false
|
177
|
-
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
179
|
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
- !ruby/object:Gem::Dependency
|
183
183
|
name: celluloid
|
184
|
-
|
184
|
+
requirement: !ruby/object:Gem::Requirement
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
188
|
version: 0.17.2
|
189
189
|
type: :runtime
|
190
190
|
prerelease: false
|
191
|
-
|
191
|
+
version_requirements: !ruby/object:Gem::Requirement
|
192
192
|
requirements:
|
193
193
|
- - ">="
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: 0.17.2
|
196
196
|
- !ruby/object:Gem::Dependency
|
197
197
|
name: celluloid-essentials
|
198
|
-
|
198
|
+
requirement: !ruby/object:Gem::Requirement
|
199
199
|
requirements:
|
200
200
|
- - ">="
|
201
201
|
- !ruby/object:Gem::Version
|
202
202
|
version: '0'
|
203
203
|
type: :development
|
204
204
|
prerelease: false
|
205
|
-
|
205
|
+
version_requirements: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
207
|
- - ">="
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0'
|
210
210
|
- !ruby/object:Gem::Dependency
|
211
211
|
name: celluloid-supervision
|
212
|
-
|
212
|
+
requirement: !ruby/object:Gem::Requirement
|
213
213
|
requirements:
|
214
214
|
- - ">="
|
215
215
|
- !ruby/object:Gem::Version
|
216
216
|
version: '0'
|
217
217
|
type: :development
|
218
218
|
prerelease: false
|
219
|
-
|
219
|
+
version_requirements: !ruby/object:Gem::Requirement
|
220
220
|
requirements:
|
221
221
|
- - ">="
|
222
222
|
- !ruby/object:Gem::Version
|
223
223
|
version: '0'
|
224
224
|
- !ruby/object:Gem::Dependency
|
225
225
|
name: celluloid-pool
|
226
|
-
|
226
|
+
requirement: !ruby/object:Gem::Requirement
|
227
227
|
requirements:
|
228
228
|
- - ">="
|
229
229
|
- !ruby/object:Gem::Version
|
230
230
|
version: '0'
|
231
231
|
type: :development
|
232
232
|
prerelease: false
|
233
|
-
|
233
|
+
version_requirements: !ruby/object:Gem::Requirement
|
234
234
|
requirements:
|
235
235
|
- - ">="
|
236
236
|
- !ruby/object:Gem::Version
|
237
237
|
version: '0'
|
238
238
|
- !ruby/object:Gem::Dependency
|
239
239
|
name: celluloid-fsm
|
240
|
-
|
240
|
+
requirement: !ruby/object:Gem::Requirement
|
241
241
|
requirements:
|
242
242
|
- - ">="
|
243
243
|
- !ruby/object:Gem::Version
|
244
244
|
version: '0'
|
245
245
|
type: :development
|
246
246
|
prerelease: false
|
247
|
-
|
247
|
+
version_requirements: !ruby/object:Gem::Requirement
|
248
248
|
requirements:
|
249
249
|
- - ">="
|
250
250
|
- !ruby/object:Gem::Version
|
251
251
|
version: '0'
|
252
252
|
- !ruby/object:Gem::Dependency
|
253
253
|
name: celluloid-extras
|
254
|
-
|
254
|
+
requirement: !ruby/object:Gem::Requirement
|
255
255
|
requirements:
|
256
256
|
- - ">="
|
257
257
|
- !ruby/object:Gem::Version
|
258
258
|
version: '0'
|
259
259
|
type: :development
|
260
260
|
prerelease: false
|
261
|
-
|
261
|
+
version_requirements: !ruby/object:Gem::Requirement
|
262
262
|
requirements:
|
263
263
|
- - ">="
|
264
264
|
- !ruby/object:Gem::Version
|
265
265
|
version: '0'
|
266
266
|
- !ruby/object:Gem::Dependency
|
267
267
|
name: timers
|
268
|
-
|
268
|
+
requirement: !ruby/object:Gem::Requirement
|
269
269
|
requirements:
|
270
270
|
- - ">="
|
271
271
|
- !ruby/object:Gem::Version
|
272
272
|
version: 4.1.1
|
273
273
|
type: :runtime
|
274
274
|
prerelease: false
|
275
|
-
|
275
|
+
version_requirements: !ruby/object:Gem::Requirement
|
276
276
|
requirements:
|
277
277
|
- - ">="
|
278
278
|
- !ruby/object:Gem::Version
|
279
279
|
version: 4.1.1
|
280
280
|
- !ruby/object:Gem::Dependency
|
281
281
|
name: nio4r
|
282
|
-
|
282
|
+
requirement: !ruby/object:Gem::Requirement
|
283
283
|
requirements:
|
284
284
|
- - ">="
|
285
285
|
- !ruby/object:Gem::Version
|
286
286
|
version: '1.1'
|
287
287
|
type: :runtime
|
288
288
|
prerelease: false
|
289
|
-
|
289
|
+
version_requirements: !ruby/object:Gem::Requirement
|
290
290
|
requirements:
|
291
291
|
- - ">="
|
292
292
|
- !ruby/object:Gem::Version
|
293
293
|
version: '1.1'
|
294
|
+
- !ruby/object:Gem::Dependency
|
295
|
+
name: rb-fsevent
|
296
|
+
requirement: !ruby/object:Gem::Requirement
|
297
|
+
requirements:
|
298
|
+
- - "~>"
|
299
|
+
- !ruby/object:Gem::Version
|
300
|
+
version: 0.9.1
|
301
|
+
type: :development
|
302
|
+
prerelease: false
|
303
|
+
version_requirements: !ruby/object:Gem::Requirement
|
304
|
+
requirements:
|
305
|
+
- - "~>"
|
306
|
+
- !ruby/object:Gem::Version
|
307
|
+
version: 0.9.1
|
294
308
|
description: Evented IO for Celluloid actors
|
295
309
|
email:
|
296
310
|
- tony.arcieri@gmail.com
|
@@ -323,6 +337,7 @@ files:
|
|
323
337
|
- lib/celluloid/io/dns_resolver.rb
|
324
338
|
- lib/celluloid/io/mailbox.rb
|
325
339
|
- lib/celluloid/io/reactor.rb
|
340
|
+
- lib/celluloid/io/socket.rb
|
326
341
|
- lib/celluloid/io/ssl_server.rb
|
327
342
|
- lib/celluloid/io/ssl_socket.rb
|
328
343
|
- lib/celluloid/io/stream.rb
|
@@ -338,6 +353,7 @@ files:
|
|
338
353
|
- spec/celluloid/io/dns_resolver_spec.rb
|
339
354
|
- spec/celluloid/io/mailbox_spec.rb
|
340
355
|
- spec/celluloid/io/reactor_spec.rb
|
356
|
+
- spec/celluloid/io/socket_spec.rb
|
341
357
|
- spec/celluloid/io/ssl_server_spec.rb
|
342
358
|
- spec/celluloid/io/ssl_socket_spec.rb
|
343
359
|
- spec/celluloid/io/tcp_server_spec.rb
|
@@ -375,9 +391,29 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
375
391
|
version: '0'
|
376
392
|
requirements: []
|
377
393
|
rubyforge_project:
|
378
|
-
rubygems_version: 2.
|
394
|
+
rubygems_version: 2.5.1
|
379
395
|
signing_key:
|
380
396
|
specification_version: 4
|
381
397
|
summary: Celluloid::IO allows you to monitor multiple IO objects within a Celluloid
|
382
398
|
actor
|
383
|
-
test_files:
|
399
|
+
test_files:
|
400
|
+
- spec/celluloid/io/actor_spec.rb
|
401
|
+
- spec/celluloid/io/dns_resolver_spec.rb
|
402
|
+
- spec/celluloid/io/mailbox_spec.rb
|
403
|
+
- spec/celluloid/io/reactor_spec.rb
|
404
|
+
- spec/celluloid/io/socket_spec.rb
|
405
|
+
- spec/celluloid/io/ssl_server_spec.rb
|
406
|
+
- spec/celluloid/io/ssl_socket_spec.rb
|
407
|
+
- spec/celluloid/io/tcp_server_spec.rb
|
408
|
+
- spec/celluloid/io/tcp_socket_spec.rb
|
409
|
+
- spec/celluloid/io/udp_socket_spec.rb
|
410
|
+
- spec/celluloid/io/unix_server_spec.rb
|
411
|
+
- spec/celluloid/io/unix_socket_spec.rb
|
412
|
+
- spec/celluloid/io_spec.rb
|
413
|
+
- spec/fixtures/client.crt
|
414
|
+
- spec/fixtures/client.key
|
415
|
+
- spec/fixtures/server.crt
|
416
|
+
- spec/fixtures/server.key
|
417
|
+
- spec/spec_helper.rb
|
418
|
+
- spec/support/examples/classes.rb
|
419
|
+
- spec/support/examples/methods.rb
|