async-io 1.18.4 → 1.18.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async/io/host_endpoint.rb +1 -0
- data/lib/async/io/tcp_socket.rb +8 -2
- data/lib/async/io/version.rb +1 -1
- data/spec/async/io/tcp_socket_spec.rb +23 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4521c94506778f0d7e6f5dec2fe76bf6b6f0374ae3c327e29775063bd3393aaa
|
4
|
+
data.tar.gz: 56d1f0388b1d1a64a87dbb5086bcbd209602933ab805fae44ea6e699cc3eba8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c84cb8f453e9b7c7f80af18443d04eaeca38e46172afbc1ec4f6c219123449a5b8744d72db0c282e2d3da8826f29aa64f331698608a589c9c35a761bc6531f4
|
7
|
+
data.tar.gz: 027bf4fc6e910b3e1fdf883f7aa6a98045131f43318a014f77bb6e1734d9e932f95bd54fb23b9237e9ef78bccb1f70fc52c424ece21020e31663ea3a6b151ffe
|
@@ -49,6 +49,7 @@ module Async
|
|
49
49
|
Addrinfo.foreach(*@specification) do |address|
|
50
50
|
begin
|
51
51
|
return Socket.connect(address, **@options, &block)
|
52
|
+
# This is a little bit risky. In theory, what it is supposed to do is catch the failed connection, and try the next address. In practice, it can catch other kinds of failures. Ideally, it only applies to `#connect`, but it also applies to what's executed in `&block`.
|
52
53
|
rescue
|
53
54
|
last_error = $!
|
54
55
|
end
|
data/lib/async/io/tcp_socket.rb
CHANGED
data/lib/async/io/version.rb
CHANGED
@@ -33,10 +33,11 @@ RSpec.describe Async::IO::TCPSocket do
|
|
33
33
|
|
34
34
|
describe Async::IO::TCPServer do
|
35
35
|
it_should_behave_like Async::IO::Generic
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
end
|
37
|
+
|
38
|
+
describe Async::IO::TCPServer do
|
39
|
+
let!(:server_task) do
|
40
|
+
reactor.async do |task|
|
40
41
|
server = Async::IO::TCPServer.new("localhost", 6788)
|
41
42
|
|
42
43
|
peer, address = server.accept
|
@@ -47,9 +48,26 @@ RSpec.describe Async::IO::TCPSocket do
|
|
47
48
|
peer.close
|
48
49
|
server.close
|
49
50
|
end
|
51
|
+
end
|
52
|
+
|
53
|
+
let(:client) {Async::IO::TCPSocket.new("localhost", 6788)}
|
54
|
+
|
55
|
+
it "can read into outbuf" do
|
56
|
+
client.puts("Hello World")
|
57
|
+
|
58
|
+
outbuf = String.new
|
59
|
+
# 20 is bigger than echo response...
|
60
|
+
data = client.read(20, outbuf)
|
50
61
|
|
51
|
-
|
62
|
+
expect(outbuf).to_not be_empty
|
63
|
+
expect(outbuf).to be == data
|
52
64
|
|
65
|
+
client.close
|
66
|
+
server_task.wait
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should start server and send data" do
|
70
|
+
# Accept a single incoming connection and then finish.
|
53
71
|
client.puts(data)
|
54
72
|
expect(client.gets).to be == data
|
55
73
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.18.
|
4
|
+
version: 1.18.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|