Skip to content

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 <ichibon0@gmail.com>
[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

}
}

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