summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-08-09 21:56:34 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-08-15 15:21:18 -0400
commit0e27817133b931dcbe9d196e9ed0d737164ba613 (patch)
treef29c078df7d28c05763dd0db803dd3548a08b648
parent711c9015c3845eb7ff733ea34829c4ecf32d8ab5 (diff)
downloadsssd-0e27817133b931dcbe9d196e9ed0d737164ba613.tar.gz
sssd-0e27817133b931dcbe9d196e9ed0d737164ba613.tar.bz2
sssd-0e27817133b931dcbe9d196e9ed0d737164ba613.zip
Do not delete requests inside hash_iterate loop
-rw-r--r--src/responder/common/responder_dp.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/responder/common/responder_dp.c b/src/responder/common/responder_dp.c
index 8050e06f..a89425c4 100644
--- a/src/responder/common/responder_dp.c
+++ b/src/responder/common/responder_dp.c
@@ -107,22 +107,24 @@ static int sss_dp_req_destructor(void *ptr)
return 0;
}
-static bool reconnect_handler(hash_entry_t *item, void *user_data)
-{
- struct sss_dp_req *sdp_req = talloc_get_type(item->value.ptr,
- struct sss_dp_req);
-
- return (talloc_free(sdp_req) == EOK ? true : false);
-}
-
void handle_requests_after_reconnect(void)
{
int ret;
+ hash_value_t *values;
+ unsigned long count, i;
+ struct sss_dp_req *sdp_req;
- ret = hash_iterate(dp_requests, reconnect_handler, NULL);
+ ret = hash_values(dp_requests, &count, &values);
if (ret != HASH_SUCCESS) {
- DEBUG(1, ("hash_iterate failed, "
+ DEBUG(1, ("hash_values failed, "
"not all request might be handled after reconnect.\n"));
+ return;
+ }
+
+ DEBUG(7, ("Will handle %lu requests after reconnect\n", count));
+ for (i=0; i<count; i++) {
+ sdp_req = talloc_get_type(values[i].ptr, struct sss_dp_req);
+ talloc_free(sdp_req);
}
}