-
Notifications
You must be signed in to change notification settings - Fork 245
Split socket/SSLSocket nonblock methods into exception: overloads
#2963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9332,7 +9332,8 @@ module OpenSSL | |
| # Reads *length* bytes from the SSL connection. If a pre-allocated *buffer* is | ||
| # provided the data will be written into it. | ||
| # | ||
| def sysread_nonblock: (*untyped) -> untyped | ||
| def sysread_nonblock: (Integer length, ?String buffer, ?exception: true) -> String | ||
| | (Integer length, ?String buffer, exception: false) -> (String | :wait_readable | :wait_writable | nil) | ||
|
|
||
| # <!-- | ||
| # rdoc-file=ext/openssl/ossl_ssl.c | ||
|
|
@@ -9341,7 +9342,8 @@ module OpenSSL | |
| # Writes *string* to the SSL connection in a non-blocking manner. Raises an | ||
| # SSLError if writing would block. | ||
| # | ||
| def syswrite_nonblock: (*untyped) -> untyped | ||
| def syswrite_nonblock: (_ToS string, ?exception: true) -> Integer | ||
| | (_ToS string, exception: false) -> (Integer | :wait_readable | :wait_writable | nil) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The And, Based on the implementation, |
||
|
|
||
| # <!-- | ||
| # rdoc-file=ext/openssl/lib/openssl/ssl.rb | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -330,7 +330,8 @@ class BasicSocket < IO | |
| # ### See | ||
| # * Socket#recvfrom | ||
| # | ||
| def recv_nonblock: (Integer maxlen, ?Integer flags, ?String buf, ?exception: boolish) -> (String | :wait_readable) | ||
| def recv_nonblock: (Integer maxlen, ?Integer flags, ?String buf, ?exception: true) -> String | ||
| | (Integer maxlen, ?Integer flags, ?String buf, exception: false) -> (String | :wait_readable) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the documentation states that |
||
|
|
||
| # <!-- | ||
| # rdoc-file=ext/socket/lib/socket.rb | ||
|
|
@@ -401,7 +402,8 @@ class BasicSocket < IO | |
| # recvmsg_nonblock should not raise an IO::WaitReadable exception, but return | ||
| # the symbol <code>:wait_readable</code> instead. | ||
| # | ||
| def recvmsg_nonblock: (?Integer dlen, ?Integer flags, ?Integer clen, ?exception: boolish, ?scm_rights: boolish) -> ([ String, Addrinfo, Integer?, Array[Socket::AncillaryData] ] | :wait_readable) | ||
| def recvmsg_nonblock: (?Integer dlen, ?Integer flags, ?Integer clen, ?exception: true, ?scm_rights: boolish) -> [ String, Addrinfo, Integer?, Array[Socket::AncillaryData] ] | ||
| | (?Integer dlen, ?Integer flags, ?Integer clen, exception: false, ?scm_rights: boolish) -> ([ String, Addrinfo, Integer?, Array[Socket::AncillaryData] ] | :wait_readable) | ||
|
|
||
| # <!-- | ||
| # rdoc-file=ext/socket/basicsocket.c | ||
|
|
@@ -489,7 +491,8 @@ class BasicSocket < IO | |
| # sendmsg_nonblock should not raise an IO::WaitWritable exception, but return | ||
| # the symbol <code>:wait_writable</code> instead. | ||
| # | ||
| def sendmsg_nonblock: (String mesg, ?Integer flags, ?Addrinfo | String dest_sockaddr, *Socket::AncillaryData controls, ?exception: boolish) -> (Integer | :wait_writable) | ||
| def sendmsg_nonblock: (String mesg, ?Integer flags, ?Addrinfo | String dest_sockaddr, *Socket::AncillaryData controls, ?exception: true) -> Integer | ||
| | (String mesg, ?Integer flags, ?Addrinfo | String dest_sockaddr, *Socket::AncillaryData controls, exception: false) -> (Integer | :wait_writable) | ||
|
|
||
| # <!-- | ||
| # rdoc-file=ext/socket/basicsocket.c | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exception:keyword parameter must be wider thanfalse, because the precise type information may be lost:exception = rand() > 0.5 #: bool.I found
exception:accepts any object(..., exception: "true"), but it's really complicated to support these cases. So, the assumption, programmers will write theexception: true, would make sense.