laforge submitted this change.
Fix: Remove slot mapping at bankd when client disconnects
If a client disconnects before removing the slot mapping, the worker
must undefine its 'bank_id' and 'slot_nr' and must change its state to
'UNMAPPED'.
send_signal_to_worker() searches for a worker that has a given bank and
slot. If a client re-connects to a different worker and if the bank and
slot would be still assigned to the old worker, the old worker could
receive signals when assigning or removing slot mapping. The new worker
would not be mapped.
Change-Id: I2fd03490e2506c55104309a0ef952389119023b8
---
M src/bankd/bankd_main.c
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/bankd/bankd_main.c b/src/bankd/bankd_main.c
index 5e33b41..479adf0 100644
--- a/src/bankd/bankd_main.c
+++ b/src/bankd/bankd_main.c
@@ -1102,6 +1102,15 @@
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) {
+ 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 change 42645. To unsubscribe, or for help writing mail filters, visit settings.