From: Ismo Puustinen Date: Fri, 12 Apr 2013 09:06:08 +0000 (+0300) Subject: resource-asm: keep the handles below maximum. X-Git-Tag: accepted/tizen/ivi/20150112.012920~394 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84ccc5c41075fac412c8f566a511856bdfb4a866;p=profile%2Fivi%2Fmurphy.git resource-asm: keep the handles below maximum. --- diff --git a/src/plugins/plugin-resource-asm.c b/src/plugins/plugin-resource-asm.c index ea91433..fbdcecc 100644 --- a/src/plugins/plugin-resource-asm.c +++ b/src/plugins/plugin-resource-asm.c @@ -612,6 +612,20 @@ static uint32_t get_handle(uint32_t data) { } #endif + +static uint32_t get_next_handle(client_t *client) +{ + uint32_t retval = client->current_handle; + + client->current_handle++; + + if (client->current_handle == ASM_SERVER_HANDLE_MAX) + client->current_handle = 1; + + return retval; +} + + static void htbl_free_client_class(void *key, void *object) { client_class_t *client_class = (client_class_t *) object; @@ -996,7 +1010,7 @@ static asm_to_lib_t *process_msg(lib_to_asm_t *msg, asm_data_t *ctx) goto error; } - handle = client->current_handle++; + handle = get_next_handle(client); d = (resource_set_data_t *) mrp_allocz(sizeof(resource_set_data_t)); if (!d)