Skip to content

Merge the main branch into package #4977

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

Merged
merged 10 commits into from
Jun 10, 2024
Merged

Merge the main branch into package #4977

merged 10 commits into from
Jun 10, 2024

Conversation

parkera
Copy link
Contributor

@parkera parkera commented Jun 10, 2024

Incorporate latest updates from main into package.

lxbndr and others added 10 commits December 25, 2023 14:39
CURL documentation (https://curl.se/libcurl/c/CURLMOPT_TIMERFUNCTION.html)
explicitly says that the timer should be one-time. We basically have to
follow CURL requests for setting, resetting and disarming such timers.

Current logic eventually leaves a 1ms repeating timer forever, because
CURL assumes it fires once, and may not ask us to remove it explicitly.

Also, being used as request timeout trigger, this timer also has no sense
to be repeated.
Extends socket lifetime enough to let DispatchSource cancel properly.
Also prevents from creating new DispatchSources while other are in the
middle of cancelling.

Also includes tests (see swiftlang#4854 for test details).
Fixes swiftlang/swift#73532.

On Windows, socket handles in a `fd_set` are not represented as
bit flags as in Berkeley sockets. While we have no `fd_set` dynamic
growth in this implementation, the `FD_SETSIZE` defined as 1024
in `CoreFoundation_Prefix.h` should be enough for majority of tasks.
[Windows] Use `fd_set` according to Winsock2 specifics
* Add `data(from:delegate:)` method.

* Add async URLSession methods

---------

Co-authored-by: ichiho <[email protected]>
[wasm] Do not set permissions in `Data.write`
Copy link
Contributor

@jmschonfeld jmschonfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -666,6 +682,231 @@ internal extension URLSession {
}
}

fileprivate struct Lock<State>: @unchecked Sendable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't have to be a part of this PR, but maybe we should expose FoundationEssentials.LockedState as @_spi to avoid inventing yet another lock type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll soon be able to use Mutex anyway.

@parkera parkera merged commit fbbe6fa into swiftlang:package Jun 10, 2024
@parkera parkera linked an issue Jul 5, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adopt swift-foundation
8 participants