bankd: Don't create 10 workers, but 'num_slots' workers

Change-Id: Ie86321e3f61ed86bbbe2ca8cfbd9edde6060bb9f
This commit is contained in:
Harald Welte 2019-03-09 20:59:34 +01:00
parent f4b16f1c11
commit a0f395043e
2 changed files with 7 additions and 2 deletions

View File

@ -83,6 +83,7 @@ struct bankd_worker {
struct bankd {
struct {
uint16_t bank_id;
uint16_t num_slots;
} cfg;
struct app_comp_id comp_id;

View File

@ -76,6 +76,10 @@ static void bankd_init(struct bankd *bankd)
INIT_LLIST_HEAD(&bankd->workers);
pthread_mutex_init(&bankd->workers_mutex, NULL);
/* set some defaults, overridden by commandline/config */
bankd->cfg.bank_id = 1;
bankd->cfg.num_slots = 8;
bankd->comp_id.type = ComponentType_remsimBankd;
OSMO_STRLCPY_ARRAY(bankd->comp_id.name, "fixme-name");
OSMO_STRLCPY_ARRAY(bankd->comp_id.software, "remsim-bankd");
@ -187,8 +191,8 @@ int main(int argc, char **argv)
exit(1);
g_bankd->accept_fd = rc;
/* create worker threads. FIXME: one per reader/slot! */
for (i = 0; i < 10; i++) {
/* create worker threads: One per reader/slot! */
for (i = 0; i < g_bankd->cfg.num_slots; i++) {
struct bankd_worker *w;
w = bankd_create_worker(g_bankd, i);
if (!w)