jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/42645?usp=email ) Change subject: Fix: Remove slot mapping at bankd when client disconnects ...................................................................... Fix: Remove slot mapping at bankd when client disconnects If a client disconnects before removing the slot mapping, the slotmap entry will not be removed automatically. A subsequent client connection for the same mapping will then trigger the the error: “ignoring identical slotmap.” In a setup with multiple readers, there are multiple bankd worker threads. If a client re-connects, but if its connection is accepted by a different thread, subsequent reader access or unmapping will fail. There will be no mapping at the new thread. The approach of this fix is to remove the slot mapping, if the client connection to the worker thread terminates. Change-Id: I2fd03490e2506c55104309a0ef952389119023b8 --- M src/bankd/bankd_main.c 1 file changed, 10 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/45/42645/1 diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c index 5e33b41..99a5949 100644 --- a/src/bankd/bankd_main.c +++ b/src/bankd/bankd_main.c @@ -1102,6 +1102,16 @@ close(g_worker->client.fd); memset(&g_worker->client.peer_addr, 0, sizeof(g_worker->client.peer_addr)); g_worker->client.fd = -1; + if (g_worker->state >= BW_ST_CONN_CLIENT_MAPPED) { + struct slot_mapping *slmap; + slmap = slotmap_by_client(g_worker->bankd->slotmaps, &g_worker->client.clslot); + if (slmap) { + slotmap_del(g_bankd->slotmaps, slmap); + g_worker->slot.bank_id = 0xffff; + g_worker->slot.slot_nr = 0xffff; + worker_set_state(g_worker, BW_ST_CONN_CLIENT_UNMAPPED, true); + } + } g_worker->client.clslot.client_id = g_worker->client.clslot.slot_nr = 0; } -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/42645?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: I2fd03490e2506c55104309a0ef952389119023b8 Gerrit-Change-Number: 42645 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas@eversberg.eu>