Before this patch, libkrad would follow the same exact logic for all
socket types when the retries parameter was non-zero. This meant that
when connecting with SOCK_STREAM, multiple requests were sent in case
of packet drops, which, of course, cannot happen for SOCK_STREAM.
Instead, just disable retries for SOCK_STREAM sockets.
[ghudson@mit.edu: minor wording edits]
ticket: 8229 (new)
target_version: 1.13.3
tags: pullup
* - hostname:service
*
* The timeout parameter (milliseconds) is the total timeout across all remote
- * hosts (when DNS returns multiple entries) and all retries.
+ * hosts (when DNS returns multiple entries) and all retries. For stream
+ * sockets, the retries parameter is ignored and no retries are performed.
*
* The cb function will be called with the data argument when either a response
* is received or the request times out on all possible remote hosts.
krb5_error_code retval;
request *r;
+ if (rr->info->ai_socktype == SOCK_STREAM)
+ retries = 0;
+
r = TAILQ_FIRST(&rr->list);
retval = krad_packet_new_request(rr->kctx, rr->secret, code, attrs,
(krad_packet_iter_cb)iterator, &r, &tmp);