#### Pre-Submission Checklist
  - [x] Commit message has the format required by CONTRIBUTING guide
  - [x] Commits are split per component (core, individual modules, libs, utils, 
...)
  - [x] Each component has a single commit (if not, squash them into one commit)
  - [x] No commits to README files for modules (changes must be done to docbook 
files
  in `doc/` subfolder, the README file is autogenerated)

  #### Type Of Change
  - [x] Small bug fix (non-breaking change which fixes an issue)
  - [ ] New feature (non-breaking change which adds new functionality)
  - [ ] Breaking change (fix or feature that would change existing 
functionality)

  #### Checklist:
  - [x] PR should be backported to stable branches
  - [x] Tested changes locally
  - [ ] Related to issue #XXXX (replace XXXX with an open issue number)

  #### Description

  This PR fixes the initialization behavior when `init_without_redis=1` and 
multiple Redis servers are configured. Previously, if any server failed during 
init, the entire initialization would stop and no servers (including 
successfully
  connected ones) would be initialized.

  **Changes:**
  - when init_without_redis=1 and a server fails during init, continue 
initializing remaining servers instead of stopping
  - moved error handling (err and err2 labels) inside the server loop to allow 
continuation after failures
  - properly free failed context and set ctxRedis=NULL for failed servers
  - allows setups with multiple Redis servers to have partial initialization 
when some servers are unavailable

  **Example Configuration:**
  #!define REDIS_A "name=srvA;addr=127.0.0.1;port=6379;db=0"
  #!define REDIS_B "name=srvB;addr=127.0.0.2;port=6379;db=0"
  #!define REDIS_C "name=srvC;addr=127.0.0.3;port=6379;db=0"

  modparam("ndb_redis", "server", REDIS_A)
  modparam("ndb_redis", "server", REDIS_B)
  modparam("ndb_redis", "server", REDIS_C)
  modparam("ndb_redis", "init_without_redis", 1)

  **Previous Behavior:**
  - srvA connects successfully
  - srvB fails to connect
  - error handler exits immediately with return 0
  - srvC is never attempted
  - Result: NO servers initialized, srvA connection lost

  **New Behavior:**
  - srvA connects successfully (ctxRedis valid)
  - srvB fails to connect, context freed, ctxRedis=NULL, continue loop
  - srvC connects successfully (ctxRedis valid)
  - Result: srvA and srvC available for use, srvB marked as failed
You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/4497

-- Commit Summary --

  * ndb_redis: fix error handling for multiple servers with init_without_redis

-- File Changes --

    M src/modules/ndb_redis/redis_client.c (104)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/4497.patch
https://github.com/kamailio/kamailio/pull/4497.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4497
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/pull/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to