Jinoh Kang (@iamahuman) commented about dlls/ws2_32/unixlib.c:
+{
- /* On Unix gethostbyname() may return IP addresses in random order on each call. On Windows the order of
* IP addresses is not determined as well but it is the same on consequent calls (changes after network
* resets and probably DNS timeout expiration).
* Life is Strange Remastered depends on gethostbyname() returning IP addresses in the same order to reuse
* the established TLS connection and avoid timeouts that happen in game when establishing multiple extra TLS
* connections.
* Just sorting the addresses would break server load balancing provided by gethostbyname(), so randomize the
* sort once per process. */
- unsigned int count;
- pthread_once(&hash_init_once, init_hash);
- for (count = 0; host->h_addr_list[count]; ++count)
;
- qsort_r( host->h_addr_list, count, sizeof(*host->h_addr_list), compare_addrs_hashed,
`qsort_r` is a glibc extension. Note that `gethostbyname_r`'s usage is guarded by `#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6`.