-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Introduce timeouts on sockets #6535
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? 8000 Sign in to your account
Conversation
Note: this is stacked on #6533. |
854fd28
to
a29e2c5
Compare
Espero que compreenda meu dialeto, vou analisar e ver como está . |
cc65b2a
to
3676211
Compare
`git__timer` is now `git_time_monotonic`, and returns milliseconds since an arbitrary epoch. Using a floating point to store the number of seconds elapsed was clever, as it better supports the wide range of precision from the different monotonic clocks of different systems. But we're a version control system, not a real-time clock. Milliseconds is a good enough precision for our work _and_ it's the units that system calls like `poll` take and that our users interact with. Make `git_time_monotonic` return the monotonically increasing number of milliseconds "ticked" since some arbitrary epoch.
We lose some error information from the read / write callbacks to stransport. Store our own error value in the object so that we can ensure that we rely upon it.
The `gitno` buffer interface is another layer on top of socket reads. Abstract it a bit into a "static string" that has `git_str` like semantics but without heap allocation which moves the actual reading logic into the socket / stream code, and allows for easier future usage of a static / stack-allocated `git_str`-like interface.
v0.6.0 of poxygit add support for throttling connections to test timeouts and low-bandwidth situations.
Make socket I/O non-blocking and add optional timeouts. Users may now set `GIT_OPT_SET_SERVER_CONNECT_TIMEOUT` to set a shorter connection timeout. (The connect timeout cannot be longer than the operating system default.) Users may also now configure the socket read and write timeouts with `GIT_OPT_SET_SERVER_TIMEOUT`. By default, connects still timeout based on the operating system defaults (typically 75 seconds) and socket read and writes block. Add a test against our custom testing git server that ensures that we can timeout reads against a slow server.
Not all systems have poll(2); emulate it with select(2).
`check_symbol_exists` is superior to `check_function_exists`; use it consistently in our cmake configuration
98b353e
to
8f695c8
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
The simplest and least fragile option for us, would be to simply disable use of SecurityFramework for 10.12 and earlier. That's presently being done automatically for 10.7 and earlier, via checks in CMake file |
I think it would be disappointing to use OpenSSL on macOS when there's a perfectly good SSL library that gets software updates with the system. I realize that MacPorts and Homebrew likely will do software updates, but somebody compiling libgit2 from source on 10.11 likely won't. I think that we can likely just hardcode the value (like we do for ioErr) |
Sounds good, thank you for the quick response! Is this something we should submit a PR for, or would you folks prefer to make the change? |
You're very much welcome to. I won't have time to look at it until this weekend or early next week. |
Done, thanks again for your help and quick response Edward! PR 6610 - stransport: macOS: replace errSSLNetworkTimeout, with hard-coded value |
Make socket I/O non-blocking and add optional timeouts.
Users may now set
GIT_OPT_SET_SERVER_CONNECT_TIMEOUT
to set a shorter connection timeout. (The connect timeout cannot be longer than the operating system default.) Users may also now configure the socket read and write timeouts withGIT_OPT_SET_SERVER_TIMEOUT
.By default, connects still timeout based on the operating system defaults (typically 75 seconds) and socket read and writes block.
Add a test against our custom testing git server that ensures that we can timeout reads against a slow server.