io-stream 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/io/stream/buffered.rb +10 -5
- data/lib/io/stream/generic.rb +3 -2
- data/lib/io/stream/openssl.rb +17 -0
- data/lib/io/stream/shim/shim.md +4 -0
- data/lib/io/stream/shim/timeout.rb +14 -0
- data/lib/io/stream/version.rb +1 -1
- data/lib/io/stream.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +5 -3
- metadata.gz.sig +0 -0
- /data/lib/io/{buffered.rb → stream/shim/buffered.rb} +0 -0
- /data/lib/io/{readable.rb → stream/shim/readable.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6a65103b45022f50d46603a178bb87f7bf8a11ab24da10e855dd7c18233a261
|
4
|
+
data.tar.gz: d0870c42173b4e87388ea1f3c56e68323c394cac7bf4ea1d90cd879d1c02b8a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97d1162cf543a3b604a1fe1873525d8c6278c1adac118fe165e0d1066a8421b06a4932e96e46276bc7abe8f618fe0bc89f45c5f13dd262d52c2e58e65cd5f878
|
7
|
+
data.tar.gz: 0c7db373575894a7271133aa1f610246efad907e7e168114ba677c64fbfb7a0695fd80dd286585ebdfe5af6e88f44d1f2a2c3ecf339fda540eb8ac913a2f181a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/io/stream/buffered.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright,
|
4
|
+
# Copyright, 2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'generic'
|
7
7
|
|
@@ -41,6 +41,11 @@ module IO::Stream
|
|
41
41
|
super(...)
|
42
42
|
|
43
43
|
@io = io
|
44
|
+
if io.respond_to?(:timeout)
|
45
|
+
@timeout = io.timeout
|
46
|
+
else
|
47
|
+
@timeout = nil
|
48
|
+
end
|
44
49
|
end
|
45
50
|
|
46
51
|
attr :io
|
@@ -78,9 +83,9 @@ module IO::Stream
|
|
78
83
|
|
79
84
|
case result
|
80
85
|
when :wait_readable
|
81
|
-
@io.wait_readable
|
86
|
+
@io.wait_readable(@io.timeout) or raise ::IO::TimeoutError, "read timeout"
|
82
87
|
when :wait_writable
|
83
|
-
@io.wait_writable
|
88
|
+
@io.wait_writable(@io.timeout) or raise ::IO::TimeoutError, "write timeout"
|
84
89
|
else
|
85
90
|
if result == buffer.bytesize
|
86
91
|
return
|
@@ -99,9 +104,9 @@ module IO::Stream
|
|
99
104
|
|
100
105
|
case result
|
101
106
|
when :wait_readable
|
102
|
-
@io.wait_readable
|
107
|
+
@io.wait_readable(@io.timeout) or raise ::IO::TimeoutError, "read timeout"
|
103
108
|
when :wait_writable
|
104
|
-
@io.wait_writable
|
109
|
+
@io.wait_writable(@io.timeout) or raise ::IO::TimeoutError, "write timeout"
|
105
110
|
else
|
106
111
|
return result
|
107
112
|
end
|
data/lib/io/stream/generic.rb
CHANGED
data/lib/io/stream/openssl.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2024, by Samuel Williams.
|
5
|
+
|
1
6
|
require 'openssl'
|
2
7
|
|
3
8
|
module OpenSSL
|
@@ -26,6 +31,18 @@ module OpenSSL
|
|
26
31
|
to_io.wait_writable(...)
|
27
32
|
end
|
28
33
|
end
|
34
|
+
|
35
|
+
unless method_defined?(:timeout)
|
36
|
+
def timeout
|
37
|
+
to_io.timeout
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
unless method_defined?(:timeout=)
|
42
|
+
def timeout=(value)
|
43
|
+
to_io.timeout = value
|
44
|
+
end
|
45
|
+
end
|
29
46
|
end
|
30
47
|
end
|
31
48
|
end
|
data/lib/io/stream/version.rb
CHANGED
data/lib/io/stream.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: io-stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -45,12 +45,14 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- lib/io/buffered.rb
|
49
|
-
- lib/io/readable.rb
|
50
48
|
- lib/io/stream.rb
|
51
49
|
- lib/io/stream/buffered.rb
|
52
50
|
- lib/io/stream/generic.rb
|
53
51
|
- lib/io/stream/openssl.rb
|
52
|
+
- lib/io/stream/shim/buffered.rb
|
53
|
+
- lib/io/stream/shim/readable.rb
|
54
|
+
- lib/io/stream/shim/shim.md
|
55
|
+
- lib/io/stream/shim/timeout.rb
|
54
56
|
- lib/io/stream/string_buffer.rb
|
55
57
|
- lib/io/stream/version.rb
|
56
58
|
- license.md
|
metadata.gz.sig
CHANGED
Binary file
|
File without changes
|
File without changes
|