Improve the conditions for clearing the Connection Attempt Delay upon connection failure (#12223)

* Improve the conditions for clearing the Connection Attempt Delay upon connection failure

This change addresses a case that was overlooked in ruby/ruby#12087.
In the previous change, the Connection Attempt Delay was cleared at the point of a connection failure only if both of the following conditions were met:

- No other sockets were attempting a connection
- There were addresses still available to start a new connection

In this update, the second condition has been removed.
As a result, if name resolution succeeds after a connection failure and new addresses are obtained, it will be able to immediately attempt a connection to one of them.

If there are no sockets attempting a connection, no addresses available for connection, and name resolution has completed, an exception will still be raised as before.

---

Additionally, the following minor fixes have been made:

* Refactor: Remove unnecessary members
This commit is contained in:
Misaki Shioi 2024-11-30 18:51:53 +09:00 committed by GitHub
parent fdf60d735c
commit 3d07754ee2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
Notes: git 2024-11-30 09:52:19 +00:00
Merged-By: shioimm <shioi.mm@gmail.com>
2 changed files with 3 additions and 9 deletions

View file

@ -440,9 +440,8 @@ struct fast_fallback_getaddrinfo_entry
struct fast_fallback_getaddrinfo_shared
{
int notify, refcount, connection_attempt_fds_size;
int notify, refcount;
int cancelled;
int *connection_attempt_fds;
char *node, *service;
rb_nativethread_lock_t *lock;
struct fast_fallback_getaddrinfo_entry getaddrinfo_entries[FLEX_ARY_LEN];