-
Notifications
You must be signed in to change notification settings - Fork 5.7k
feat(ext/ops): add signal option to Deno.connect()
#27113
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
feat(ext/ops): add signal option to Deno.connect()
#27113
Conversation
I think the |
I agree with @0f-0b. |
@kt3k Timeout option removed from |
Deno.Connect()
Deno.connect()
Deno.connect()
Deno.connect()
@@ -1277,6 +1277,26 @@ Deno.test({ | |||
} | |||
}); | |||
|
|||
Deno.test( | |||
{ permissions: { net: true } }, | |||
async function netTcpWithAbortSignal() { |
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.
Good test case 👍
Signed-off-by: Yoshiya Hinosawa <stibium121@gmail.com>
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.
LGTM
@bartlomieju Could you take another look?
I can confirm for #25265 that it solves my use case. |
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.
LGTM, thanks!
Related to #26819.
An optional timeout parameter has been added to the Deno.connect() interface. This parameter allows specifying a timeout (in milliseconds) within which the application must establish a connection. If the timeout is exceeded without successfully connecting, the operation is automatically aborted with an error. If the parameter is not provided, the default behavior remains unchanged (no timeout).
Currently, the timeout functionality is implemented only for TCP connections. Other connection types are not affected by this change.
Example usage:
If this solution is approved, the documentation will need to be updated to include details about the new timeout parameter.