From 602b6f7763753f863f7170369e8ac922c372dced Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 4 Dec 2019 21:51:02 +0100 Subject: [PATCH] bankd: initialize bank_id/slot_nr to 0xffff for unmapped workers Otherwise the loop for SIGMAPDEL delivery code will match any unused worker for bank_id=0/slot_nr=0, which is not what we want. This also makes repeated RemsimBankd_Tests.TC_removeMapping_connected runs work reliably. Change-Id: I6976eb96feae6a3b66bacf787e436a2df29f9ce0 --- src/bankd/bankd_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c index 94227e3..09a9e1d 100644 --- a/src/bankd/bankd_main.c +++ b/src/bankd/bankd_main.c @@ -411,6 +411,8 @@ static void handle_sig_mapdel(int sig) { LOGW(g_worker, "SIGMAPDEL received: Main thread informs us our map is gone\n"); OSMO_ASSERT(sig == SIGMAPDEL); + g_worker->slot.bank_id = 0xffff; + g_worker->slot.slot_nr = 0xffff; worker_set_state(g_worker, BW_ST_CONN_CLIENT_UNMAPPED); } @@ -852,6 +854,9 @@ static void *worker_main(void *arg) /* push cleanup helper */ pthread_cleanup_push(&worker_cleanup, g_worker); + g_worker->slot.bank_id = 0xffff; + g_worker->slot.slot_nr = 0xffff; + /* we continuously perform the same loop here, recycling the worker thread * once the client connection is gone or we have some trouble with the card/reader */ while (1) {