ione 1.3.0.pre2 → 1.3.0.pre3
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 +5 -5
- data/lib/ione/future.rb +5 -3
- data/lib/ione/io/acceptor.rb +1 -0
- data/lib/ione/io/base_connection.rb +2 -0
- data/lib/ione/io/connection.rb +1 -0
- data/lib/ione/io/io_reactor.rb +6 -6
- data/lib/ione/io/ssl_connection.rb +1 -0
- data/lib/ione/version.rb +1 -1
- data/spec/integration/io_spec.rb +3 -3
- data/spec/integration/ssl_spec.rb +7 -2
- data/spec/ione/byte_buffer_spec.rb +38 -38
- data/spec/ione/future_spec.rb +64 -65
- data/spec/ione/heap_spec.rb +18 -18
- data/spec/ione/io/acceptor_spec.rb +5 -5
- data/spec/ione/io/connection_common.rb +2 -2
- data/spec/ione/io/io_reactor_spec.rb +19 -19
- data/spec/ione/io/ssl_acceptor_spec.rb +3 -3
- data/spec/ione/io/ssl_connection_spec.rb +3 -3
- data/spec/spec_helper.rb +4 -0
- data/spec/support/fake_server.rb +1 -0
- metadata +16 -18
@@ -90,7 +90,7 @@ module Ione
|
|
90
90
|
restarted_future.value
|
91
91
|
await { sequence.size >= 2 }
|
92
92
|
begin
|
93
|
-
sequence.should
|
93
|
+
sequence.should eq([:stopped, :restarted])
|
94
94
|
ensure
|
95
95
|
reactor.stop
|
96
96
|
barrier.push(nil) while reactor.running?
|
@@ -141,8 +141,6 @@ module Ione
|
|
141
141
|
|
142
142
|
context 'when already started' do
|
143
143
|
it 'is not started again' do
|
144
|
-
calls = 0
|
145
|
-
lock = Mutex.new
|
146
144
|
ticks = Queue.new
|
147
145
|
barrier = Queue.new
|
148
146
|
selector.handler do
|
@@ -214,7 +212,7 @@ module Ione
|
|
214
212
|
it 'drains all sockets' do
|
215
213
|
reactor.start.value
|
216
214
|
TCPServer.open(0) do |server|
|
217
|
-
|
215
|
+
Thread.start { server.accept }
|
218
216
|
connection = reactor.connect(server.addr[3], server.addr[1], 5).value
|
219
217
|
writable = false
|
220
218
|
connection.stub(:stub_writable?) { writable }
|
@@ -250,7 +248,7 @@ module Ione
|
|
250
248
|
end
|
251
249
|
reactor.start.value
|
252
250
|
TCPServer.open(0) do |server|
|
253
|
-
|
251
|
+
Thread.start { server.accept }
|
254
252
|
connection = reactor.connect(server.addr[3], server.addr[1], 5).value
|
255
253
|
stopped_future = nil
|
256
254
|
mutex.synchronize do
|
@@ -357,7 +355,7 @@ module Ione
|
|
357
355
|
reactor.on_error { |e| error = e }
|
358
356
|
reactor.start
|
359
357
|
await { error }
|
360
|
-
error.message.should
|
358
|
+
error.message.should eq('Blurgh')
|
361
359
|
end
|
362
360
|
|
363
361
|
it 'calls the listener immediately when the reactor has already crashed' do
|
@@ -388,16 +386,16 @@ module Ione
|
|
388
386
|
await { !reactor.running? }
|
389
387
|
await { calls.size >= 2 }
|
390
388
|
reactor.on_error { calls << :pre_restarted }
|
391
|
-
calls.should
|
389
|
+
calls.should eq([
|
392
390
|
:pre_started,
|
393
391
|
:post_started,
|
394
392
|
:pre_restarted,
|
395
|
-
]
|
393
|
+
])
|
396
394
|
reactor.start
|
397
395
|
reactor.on_error { calls << :post_restarted }
|
398
396
|
barrier.push(nil)
|
399
397
|
await { !reactor.running? }
|
400
|
-
calls.should
|
398
|
+
calls.should eq([
|
401
399
|
:pre_started,
|
402
400
|
:post_started,
|
403
401
|
:pre_restarted,
|
@@ -405,7 +403,7 @@ module Ione
|
|
405
403
|
:post_started,
|
406
404
|
:pre_restarted,
|
407
405
|
:post_restarted,
|
408
|
-
]
|
406
|
+
])
|
409
407
|
end
|
410
408
|
end
|
411
409
|
|
@@ -425,7 +423,7 @@ module Ione
|
|
425
423
|
with_server do |host, port|
|
426
424
|
reactor.start.value
|
427
425
|
x = reactor.connect(host, port, 5) { :foo }.value
|
428
|
-
x.should
|
426
|
+
x.should eq(:foo)
|
429
427
|
end
|
430
428
|
end
|
431
429
|
|
@@ -433,7 +431,7 @@ module Ione
|
|
433
431
|
with_server do |host, port|
|
434
432
|
reactor.start.value
|
435
433
|
connection = reactor.connect(host, port).value
|
436
|
-
connection.connection_timeout.should
|
434
|
+
connection.connection_timeout.should eq(5)
|
437
435
|
end
|
438
436
|
end
|
439
437
|
|
@@ -441,7 +439,7 @@ module Ione
|
|
441
439
|
with_server do |host, port|
|
442
440
|
reactor.start.value
|
443
441
|
connection = reactor.connect(host, port, timeout: 9).value
|
444
|
-
connection.connection_timeout.should
|
442
|
+
connection.connection_timeout.should eq(9)
|
445
443
|
end
|
446
444
|
end
|
447
445
|
|
@@ -518,19 +516,19 @@ module Ione
|
|
518
516
|
it 'returns a future that resolves to what the given block returns' do
|
519
517
|
reactor.start.value
|
520
518
|
x = reactor.bind(ENV['SERVER_HOST'], port, 5) { |acceptor| :foo }.value
|
521
|
-
x.should
|
519
|
+
x.should eq(:foo)
|
522
520
|
end
|
523
521
|
|
524
522
|
it 'defaults to a backlog of 5' do
|
525
523
|
reactor.start.value
|
526
524
|
acceptor = reactor.bind(ENV['SERVER_HOST'], port).value
|
527
|
-
acceptor.backlog.should
|
525
|
+
acceptor.backlog.should eq(5)
|
528
526
|
end
|
529
527
|
|
530
528
|
it 'takes the backlog from the :backlog option' do
|
531
529
|
reactor.start.value
|
532
530
|
acceptor = reactor.bind(ENV['SERVER_HOST'], port, backlog: 9).value
|
533
|
-
acceptor.backlog.should
|
531
|
+
acceptor.backlog.should eq(9)
|
534
532
|
end
|
535
533
|
|
536
534
|
it 'returns the acceptor when no block is given' do
|
@@ -583,10 +581,12 @@ module Ione
|
|
583
581
|
end
|
584
582
|
|
585
583
|
it 'returns a future that is resolved after the specified duration' do
|
584
|
+
start = Time.now
|
586
585
|
clock.stub(:now).and_return(1)
|
587
|
-
f = reactor.schedule_timer(
|
588
|
-
clock.stub(:now).and_return(
|
586
|
+
f = reactor.schedule_timer(8)
|
587
|
+
clock.stub(:now).and_return(10.1)
|
589
588
|
await { f.resolved? }
|
589
|
+
expect(Time.now - start).to be < 1
|
590
590
|
end
|
591
591
|
end
|
592
592
|
|
@@ -913,4 +913,4 @@ module IoReactorSpec
|
|
913
913
|
@body.call(*args)
|
914
914
|
end
|
915
915
|
end
|
916
|
-
end
|
916
|
+
end
|
@@ -7,7 +7,7 @@ module Ione
|
|
7
7
|
module Io
|
8
8
|
describe SslAcceptor do
|
9
9
|
let :acceptor do
|
10
|
-
described_class.new('example.com', 4321,
|
10
|
+
described_class.new('example.com', 4321, 3, unblocker, reactor, ssl_context, socket_impl, ssl_socket_impl)
|
11
11
|
end
|
12
12
|
|
13
13
|
let :unblocker do
|
@@ -80,8 +80,8 @@ module Ione
|
|
80
80
|
acceptor.bind
|
81
81
|
acceptor.read
|
82
82
|
accepted_handlers.should have(1).item
|
83
|
-
accepted_handlers.first.host.should
|
84
|
-
accepted_handlers.first.port.should
|
83
|
+
accepted_handlers.first.host.should eq('example.com')
|
84
|
+
accepted_handlers.first.port.should eq(3333)
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'returns the raw socket from #to_io' do
|
@@ -124,7 +124,7 @@ module Ione
|
|
124
124
|
end
|
125
125
|
handler.connect
|
126
126
|
handler.read
|
127
|
-
read_sizes.drop(1).should
|
127
|
+
read_sizes.drop(1).should eq([read_sizes.first] * 3)
|
128
128
|
end
|
129
129
|
else
|
130
130
|
it 'reads and initial chunk of data' do
|
@@ -134,7 +134,7 @@ module Ione
|
|
134
134
|
ssl_socket.stub(:read_nonblock).and_return('fooo')
|
135
135
|
handler.connect
|
136
136
|
handler.read
|
137
|
-
data.should
|
137
|
+
data.should eq(['fooo'])
|
138
138
|
end
|
139
139
|
|
140
140
|
it 'reads once, and then again with the value of #pending, until #pending returns zero' do
|
@@ -149,7 +149,7 @@ module Ione
|
|
149
149
|
end
|
150
150
|
handler.connect
|
151
151
|
handler.read
|
152
|
-
read_sizes.drop(1).should
|
152
|
+
read_sizes.drop(1).should eq([3, 2, 1])
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/fake_server.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ione
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.0.
|
4
|
+
version: 1.3.0.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theo Hultberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Reactive programming framework for Ruby, painless evented IO, futures
|
14
14
|
and an efficient byte buffer
|
@@ -53,7 +53,7 @@ files:
|
|
53
53
|
- spec/support/server_helper.rb
|
54
54
|
homepage: http://github.com/iconara/ione
|
55
55
|
licenses:
|
56
|
-
- Apache
|
56
|
+
- Apache-2.0
|
57
57
|
metadata: {}
|
58
58
|
post_install_message:
|
59
59
|
rdoc_options: []
|
@@ -70,27 +70,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: 1.3.1
|
72
72
|
requirements: []
|
73
|
-
|
74
|
-
rubygems_version: 2.2.2
|
73
|
+
rubygems_version: 3.0.3
|
75
74
|
signing_key:
|
76
75
|
specification_version: 4
|
77
76
|
summary: Reactive programming framework for Ruby
|
78
77
|
test_files:
|
79
|
-
- spec/
|
80
|
-
- spec/
|
81
|
-
- spec/ione/
|
82
|
-
- spec/ione/
|
83
|
-
- spec/ione/heap_spec.rb
|
78
|
+
- spec/spec_helper.rb
|
79
|
+
- spec/ione/io/ssl_acceptor_spec.rb
|
80
|
+
- spec/ione/io/server_connection_spec.rb
|
81
|
+
- spec/ione/io/ssl_server_connection_spec.rb
|
84
82
|
- spec/ione/io/acceptor_spec.rb
|
85
|
-
- spec/ione/io/connection_common.rb
|
86
83
|
- spec/ione/io/connection_spec.rb
|
87
|
-
- spec/ione/io/io_reactor_spec.rb
|
88
|
-
- spec/ione/io/server_connection_spec.rb
|
89
|
-
- spec/ione/io/ssl_acceptor_spec.rb
|
90
84
|
- spec/ione/io/ssl_connection_spec.rb
|
91
|
-
- spec/ione/io/
|
92
|
-
- spec/
|
85
|
+
- spec/ione/io/io_reactor_spec.rb
|
86
|
+
- spec/ione/io/connection_common.rb
|
87
|
+
- spec/ione/heap_spec.rb
|
88
|
+
- spec/ione/byte_buffer_spec.rb
|
89
|
+
- spec/ione/future_spec.rb
|
90
|
+
- spec/integration/ssl_spec.rb
|
91
|
+
- spec/integration/io_spec.rb
|
92
|
+
- spec/support/server_helper.rb
|
93
93
|
- spec/support/await_helper.rb
|
94
94
|
- spec/support/fake_server.rb
|
95
|
-
- spec/support/server_helper.rb
|
96
|
-
has_rdoc:
|