From 0e27817133b931dcbe9d196e9ed0d737164ba613 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 9 Aug 2011 21:56:34 +0200 Subject: Do not delete requests inside hash_iterate loop --- src/responder/common/responder_dp.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/responder') 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