summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-resolve/sd-resolve.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libsystemd/sd-resolve/sd-resolve.c b/src/libsystemd/sd-resolve/sd-resolve.c
index 15f1938639..fea695fcf9 100644
--- a/src/libsystemd/sd-resolve/sd-resolve.c
+++ b/src/libsystemd/sd-resolve/sd-resolve.c
@@ -87,7 +87,7 @@ struct sd_resolve {
unsigned current_id;
sd_resolve_query* query_array[QUERIES_MAX];
- unsigned n_queries, n_done;
+ unsigned n_queries, n_done, n_outstanding;
sd_event_source *event_source;
sd_event *event;
@@ -526,7 +526,7 @@ static int start_threads(sd_resolve *resolve, unsigned extra) {
unsigned n;
int r;
- n = resolve->n_queries + extra - resolve->n_done;
+ n = resolve->n_outstanding + extra;
n = CLAMP(n, WORKERS_MIN, WORKERS_MAX);
while (resolve->n_valid_workers < n) {
@@ -854,6 +854,9 @@ static int handle_response(sd_resolve *resolve, const Packet *packet, size_t len
return 0;
}
+ assert(resolve->n_outstanding > 0);
+ resolve->n_outstanding--;
+
q = lookup_query(resolve, resp->id);
if (!q)
return 0;
@@ -1099,6 +1102,8 @@ _public_ int sd_resolve_getaddrinfo(
return -errno;
}
+ resolve->n_outstanding++;
+
if (_q)
*_q = q;
@@ -1167,6 +1172,8 @@ _public_ int sd_resolve_getnameinfo(
return -errno;
}
+ resolve->n_outstanding++;
+
if (_q)
*_q = q;
@@ -1231,6 +1238,8 @@ static int resolve_res(
return -errno;
}
+ resolve->n_outstanding++;
+
if (_q)
*_q = q;