async-io 1.42.0 → 1.43.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31130dc24e434d73f9909d91b7801db806eb65cf8ae0d26e51793287b086855b
4
- data.tar.gz: 766af3924c07a993aa99d6052a23be8bb50127dc13b6fd16ce2b22638ea9dd38
3
+ metadata.gz: 071d4c65cf79b0114f950285653b697d06949878a919fa256806f7c9dae40253
4
+ data.tar.gz: 5f9610ec6b8e8de0c4160c1e66d07b1549c9cbbf286bbb5443f033c5399ae549
5
5
  SHA512:
6
- metadata.gz: a2c22340c93e343a03091590c28fbc1d805613c2e7641faaeac6d1fc43d0c96d6fe9cbf61db69cefb38fcba3bc7520818749c105b2ad7821bafe77885996c644
7
- data.tar.gz: 7694ac4f58dd65fc7f352b710000da20551b2b79c50bc5d87fe96f8a1c0720f31c11dbf8b570893408dc53e45db23996ab65937227d8be358214a7d0d7ed9d0a
6
+ metadata.gz: f86354aec7425c48afb078885c6e80accbed2f534802a12063d190db78b129140ffd1739293072cd95e8b94b08870c1a1b856c7cd8931e0f45ff7ed909b4b830
7
+ data.tar.gz: 658b16d8c97799b3d5acfa7e78c2b4e542b9835ca2aa236ee378c39f612f4683fd17be6e3d924a2c673ccbadd021531f3c921bce1e82d35175c80a799a88d77e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2017-2023, by Samuel Williams.
4
+ # Copyright, 2017-2024, by Samuel Williams.
5
5
  # Copyright, 2019, by Olle Jonsson.
6
6
 
7
7
  require_relative 'address'
@@ -3,6 +3,7 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2017-2023, by Samuel Williams.
5
5
  # Copyright, 2021, by Aurora Nockert.
6
+ # Copyright, 2023, by Patrik Wenger.
6
7
 
7
8
  require 'async/wrapper'
8
9
  require 'forwardable'
@@ -191,6 +192,10 @@ module Async
191
192
  !@io.closed?
192
193
  end
193
194
 
195
+ def readable?
196
+ @io.readable?
197
+ end
198
+
194
199
  attr_accessor :timeout
195
200
 
196
201
  protected
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
5
  # Copyright, 2019, by Olle Jonsson.
6
6
 
7
7
  require_relative 'endpoint'
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
5
  # Copyright, 2019, by Olle Jonsson.
6
6
 
7
7
  require_relative 'host_endpoint'
@@ -51,10 +51,14 @@ module Async
51
51
  super
52
52
  else
53
53
  io = self.class.wrapped_klass.new(socket.to_io, context)
54
- super(io, socket.reactor)
55
-
56
- # We detach the socket from the reactor, otherwise it's possible to add the file descriptor to the selector twice, which is bad.
57
- socket.reactor = nil
54
+ if socket.respond_to?(:reactor)
55
+ super(io, socket.reactor)
56
+
57
+ # We detach the socket from the reactor, otherwise it's possible to add the file descriptor to the selector twice, which is bad.
58
+ socket.reactor = nil
59
+ else
60
+ super(io)
61
+ end
58
62
 
59
63
  # This ensures that when the internal IO is closed, it also closes the internal socket:
60
64
  io.sync_close = true
@@ -4,6 +4,7 @@
4
4
  # Copyright, 2017-2023, by Samuel Williams.
5
5
  # Copyright, 2018, by Janko Marohnić.
6
6
  # Copyright, 2021, by Aurora Nockert.
7
+ # Copyright, 2023, by Maruth Goyal.
7
8
 
8
9
  require_relative 'buffer'
9
10
  require_relative 'generic'
@@ -196,6 +197,10 @@ module Async
196
197
  @io.connected?
197
198
  end
198
199
 
200
+ def readable?
201
+ @io.readable?
202
+ end
203
+
199
204
  def closed?
200
205
  @io.closed?
201
206
  end
@@ -245,6 +250,21 @@ module Async
245
250
 
246
251
  private
247
252
 
253
+ def sysread(size, buffer)
254
+ while true
255
+ result = @io.read_nonblock(size, buffer, exception: false)
256
+
257
+ case result
258
+ when :wait_readable
259
+ @io.wait_readable
260
+ when :wait_writable
261
+ @io.wait_writable
262
+ else
263
+ return result
264
+ end
265
+ end
266
+ end
267
+
248
268
  # Fills the buffer from the underlying stream.
249
269
  def fill_read_buffer(size = @block_size)
250
270
  # We impose a limit because the underlying `read` system call can fail if we request too much data in one go.
@@ -256,12 +276,12 @@ module Async
256
276
  flush
257
277
 
258
278
  if @read_buffer.empty?
259
- if @io.read_nonblock(size, @read_buffer, exception: false)
279
+ if sysread(size, @read_buffer)
260
280
  # Console.logger.debug(self, name: "read") {@read_buffer.inspect}
261
281
  return true
262
282
  end
263
283
  else
264
- if chunk = @io.read_nonblock(size, @input_buffer, exception: false)
284
+ if chunk = sysread(size, @input_buffer)
265
285
  @read_buffer << chunk
266
286
  # Console.logger.debug(self, name: "read") {@read_buffer.inspect}
267
287
 
@@ -3,6 +3,7 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2019-2023, by Samuel Williams.
5
5
  # Copyright, 2019, by Olle Jonsson.
6
+ # Copyright, 2023, by Hasan Kumar.
6
7
 
7
8
  require_relative 'address_endpoint'
8
9
 
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2017-2023, by Samuel Williams.
4
+ # Copyright, 2017-2024, by Samuel Williams.
5
5
 
6
6
  module Async
7
7
  module IO
8
- VERSION = "1.42.0"
8
+ VERSION = "1.43.0"
9
9
  end
10
10
  end
data/lib/async/io.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2017-2023, by Samuel Williams.
4
+ # Copyright, 2017-2024, by Samuel Williams.
5
5
 
6
6
  require 'async'
7
7
 
data/license.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2017-2023, by Samuel Williams.
4
- Copyright, 2017-2021, by Olle Jonsson.
3
+ Copyright, 2017-2024, by Samuel Williams.
4
+ Copyright, 2017-2023, by Olle Jonsson.
5
5
  Copyright, 2018, by Janko Marohnić.
6
6
  Copyright, 2018, by Jiang Jinyang.
7
7
  Copyright, 2018, by Thibaut Girka.
@@ -9,7 +9,10 @@ Copyright, 2019-2020, by Benoit Daloze.
9
9
  Copyright, 2020, by Cyril Roelandt.
10
10
  Copyright, 2020, by Bruno Sutic.
11
11
  Copyright, 2021, by Aurora Nockert.
12
- Copyright, 2022, by Hal Brodigan.
12
+ Copyright, 2022-2023, by Hal Brodigan.
13
+ Copyright, 2023, by Hasan Kumar.
14
+ Copyright, 2023, by Maruth Goyal.
15
+ Copyright, 2023, by Patrik Wenger.
13
16
 
14
17
  Permission is hereby granted, free of charge, to any person obtaining a copy
15
18
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -135,6 +135,14 @@ We welcome contributions to this project.
135
135
  4. Push to the branch (`git push origin my-new-feature`).
136
136
  5. Create new Pull Request.
137
137
 
138
+ ### Developer Certificate of Origin
139
+
140
+ This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
141
+
142
+ ### Contributor Covenant
143
+
144
+ This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
145
+
138
146
  ## See Also
139
147
 
140
148
  - [async](https://github.com/socketry/async) — Asynchronous event-driven reactor.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,19 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.42.0
4
+ version: 1.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Olle Jonsson
9
9
  - Benoit Daloze
10
10
  - Thibaut Girka
11
+ - Hal Brodigan
11
12
  - Janko Marohnić
12
13
  - Aurora Nockert
13
14
  - Bruno Sutic
14
15
  - Cyril Roelandt
15
- - Hal Brodigan
16
+ - Hasan Kumar
16
17
  - Jiang Jinyang
18
+ - Maruth Goyal
19
+ - Patrik Wenger
17
20
  autorequire:
18
21
  bindir: bin
19
22
  cert_chain:
@@ -46,7 +49,7 @@ cert_chain:
46
49
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
47
50
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
48
51
  -----END CERTIFICATE-----
49
- date: 2024-03-25 00:00:00.000000000 Z
52
+ date: 2024-04-23 00:00:00.000000000 Z
50
53
  dependencies:
51
54
  - !ruby/object:Gem::Dependency
52
55
  name: async
@@ -62,97 +65,12 @@ dependencies:
62
65
  - - ">="
63
66
  - !ruby/object:Gem::Version
64
67
  version: '0'
65
- - !ruby/object:Gem::Dependency
66
- name: async-container
67
- requirement: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - "~>"
70
- - !ruby/object:Gem::Version
71
- version: '0.15'
72
- type: :development
73
- prerelease: false
74
- version_requirements: !ruby/object:Gem::Requirement
75
- requirements:
76
- - - "~>"
77
- - !ruby/object:Gem::Version
78
- version: '0.15'
79
- - !ruby/object:Gem::Dependency
80
- name: async-rspec
81
- requirement: !ruby/object:Gem::Requirement
82
- requirements:
83
- - - "~>"
84
- - !ruby/object:Gem::Version
85
- version: '1.10'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - "~>"
91
- - !ruby/object:Gem::Version
92
- version: '1.10'
93
- - !ruby/object:Gem::Dependency
94
- name: bake
95
- requirement: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: '0'
100
- type: :development
101
- prerelease: false
102
- version_requirements: !ruby/object:Gem::Requirement
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: '0'
107
- - !ruby/object:Gem::Dependency
108
- name: covered
109
- requirement: !ruby/object:Gem::Requirement
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- version: '0'
114
- type: :development
115
- prerelease: false
116
- version_requirements: !ruby/object:Gem::Requirement
117
- requirements:
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: '0'
121
- - !ruby/object:Gem::Dependency
122
- name: rack-test
123
- requirement: !ruby/object:Gem::Requirement
124
- requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- version: '0'
128
- type: :development
129
- prerelease: false
130
- version_requirements: !ruby/object:Gem::Requirement
131
- requirements:
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- version: '0'
135
- - !ruby/object:Gem::Dependency
136
- name: rspec
137
- requirement: !ruby/object:Gem::Requirement
138
- requirements:
139
- - - "~>"
140
- - !ruby/object:Gem::Version
141
- version: '3.6'
142
- type: :development
143
- prerelease: false
144
- version_requirements: !ruby/object:Gem::Requirement
145
- requirements:
146
- - - "~>"
147
- - !ruby/object:Gem::Version
148
- version: '3.6'
149
68
  description:
150
69
  email:
151
70
  executables: []
152
71
  extensions: []
153
72
  extra_rdoc_files: []
154
73
  files:
155
- - conduct.md
156
74
  - lib/async/io.rb
157
75
  - lib/async/io/address.rb
158
76
  - lib/async/io/address_endpoint.rb
@@ -187,7 +105,9 @@ files:
187
105
  homepage: https://github.com/socketry/async-io
188
106
  licenses:
189
107
  - MIT
190
- metadata: {}
108
+ metadata:
109
+ documentation_uri: https://socketry.github.io/async-io/
110
+ source_code_uri: https://github.com/socketry/async-io.git
191
111
  post_install_message:
192
112
  rdoc_options: []
193
113
  require_paths:
metadata.gz.sig CHANGED
Binary file
data/conduct.md DELETED
@@ -1,133 +0,0 @@
1
-
2
- # Contributor Covenant Code of Conduct
3
-
4
- ## Our Pledge
5
-
6
- We as members, contributors, and leaders pledge to make participation in our
7
- community a harassment-free experience for everyone, regardless of age, body
8
- size, visible or invisible disability, ethnicity, sex characteristics, gender
9
- identity and expression, level of experience, education, socio-economic status,
10
- nationality, personal appearance, race, caste, color, religion, or sexual
11
- identity and orientation.
12
-
13
- We pledge to act and interact in ways that contribute to an open, welcoming,
14
- diverse, inclusive, and healthy community.
15
-
16
- ## Our Standards
17
-
18
- Examples of behavior that contributes to a positive environment for our
19
- community include:
20
-
21
- * Demonstrating empathy and kindness toward other people
22
- * Being respectful of differing opinions, viewpoints, and experiences
23
- * Giving and gracefully accepting constructive feedback
24
- * Accepting responsibility and apologizing to those affected by our mistakes,
25
- and learning from the experience
26
- * Focusing on what is best not just for us as individuals, but for the overall
27
- community
28
-
29
- Examples of unacceptable behavior include:
30
-
31
- * The use of sexualized language or imagery, and sexual attention or advances of
32
- any kind
33
- * Trolling, insulting or derogatory comments, and personal or political attacks
34
- * Public or private harassment
35
- * Publishing others' private information, such as a physical or email address,
36
- without their explicit permission
37
- * Other conduct which could reasonably be considered inappropriate in a
38
- professional setting
39
-
40
- ## Enforcement Responsibilities
41
-
42
- Community leaders are responsible for clarifying and enforcing our standards of
43
- acceptable behavior and will take appropriate and fair corrective action in
44
- response to any behavior that they deem inappropriate, threatening, offensive,
45
- or harmful.
46
-
47
- Community leaders have the right and responsibility to remove, edit, or reject
48
- comments, commits, code, wiki edits, issues, and other contributions that are
49
- not aligned to this Code of Conduct, and will communicate reasons for moderation
50
- decisions when appropriate.
51
-
52
- ## Scope
53
-
54
- This Code of Conduct applies within all community spaces, and also applies when
55
- an individual is officially representing the community in public spaces.
56
- Examples of representing our community include using an official e-mail address,
57
- posting via an official social media account, or acting as an appointed
58
- representative at an online or offline event.
59
-
60
- ## Enforcement
61
-
62
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
- reported to the community leaders responsible for enforcement at
64
- [INSERT CONTACT METHOD].
65
- All complaints will be reviewed and investigated promptly and fairly.
66
-
67
- All community leaders are obligated to respect the privacy and security of the
68
- reporter of any incident.
69
-
70
- ## Enforcement Guidelines
71
-
72
- Community leaders will follow these Community Impact Guidelines in determining
73
- the consequences for any action they deem in violation of this Code of Conduct:
74
-
75
- ### 1. Correction
76
-
77
- **Community Impact**: Use of inappropriate language or other behavior deemed
78
- unprofessional or unwelcome in the community.
79
-
80
- **Consequence**: A private, written warning from community leaders, providing
81
- clarity around the nature of the violation and an explanation of why the
82
- behavior was inappropriate. A public apology may be requested.
83
-
84
- ### 2. Warning
85
-
86
- **Community Impact**: A violation through a single incident or series of
87
- actions.
88
-
89
- **Consequence**: A warning with consequences for continued behavior. No
90
- interaction with the people involved, including unsolicited interaction with
91
- those enforcing the Code of Conduct, for a specified period of time. This
92
- includes avoiding interactions in community spaces as well as external channels
93
- like social media. Violating these terms may lead to a temporary or permanent
94
- ban.
95
-
96
- ### 3. Temporary Ban
97
-
98
- **Community Impact**: A serious violation of community standards, including
99
- sustained inappropriate behavior.
100
-
101
- **Consequence**: A temporary ban from any sort of interaction or public
102
- communication with the community for a specified period of time. No public or
103
- private interaction with the people involved, including unsolicited interaction
104
- with those enforcing the Code of Conduct, is allowed during this period.
105
- Violating these terms may lead to a permanent ban.
106
-
107
- ### 4. Permanent Ban
108
-
109
- **Community Impact**: Demonstrating a pattern of violation of community
110
- standards, including sustained inappropriate behavior, harassment of an
111
- individual, or aggression toward or disparagement of classes of individuals.
112
-
113
- **Consequence**: A permanent ban from any sort of public interaction within the
114
- community.
115
-
116
- ## Attribution
117
-
118
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
- version 2.1, available at
120
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
-
122
- Community Impact Guidelines were inspired by
123
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
-
125
- For answers to common questions about this code of conduct, see the FAQ at
126
- [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
- [https://www.contributor-covenant.org/translations][translations].
128
-
129
- [homepage]: https://www.contributor-covenant.org
130
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
- [Mozilla CoC]: https://github.com/mozilla/diversity
132
- [FAQ]: https://www.contributor-covenant.org/faq
133
- [translations]: https://www.contributor-covenant.org/translations