Module: kamailio
Branch: master
Commit: 0a4654128daa05e18726824e0d6188a5b86846be
URL: 
https://github.com/kamailio/kamailio/commit/0a4654128daa05e18726824e0d6188a5b86846be

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-06-03T16:50:52+02:00

core: tcp - return null when connection not found and docs for params

---

Modified: src/core/tcp_main.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/0a4654128daa05e18726824e0d6188a5b86846be.diff
Patch: 
https://github.com/kamailio/kamailio/commit/0a4654128daa05e18726824e0d6188a5b86846be.patch

---

diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index b31e4e1ed93..625b6989ec8 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -1794,7 +1794,14 @@ struct tcp_connection *_tcpconn_find(int id, struct 
ip_addr *ip, int port,
 
 /* fallback matcher for cases where the generic wildcard-local alias
  * could not be installed due to alias collisions; it scans existing
- * connections for the same peer tuple regardless of local binding */
+ * connections for the same peer tuple regardless of local binding
+ * params:
+ *   ip - peer ip address to match (must not be NULL)
+ *   port - peer port to match (host byte order)
+ *   proto - protocol to match, PROTO_NONE for any protocol
+ * return:
+ *   matching tcp connection pointer if found, NULL otherwise
+ */
 static struct tcp_connection *_tcpconn_find_any_local(
                struct ip_addr *ip, int port, sip_protos_t proto)
 {
@@ -1802,7 +1809,7 @@ static struct tcp_connection *_tcpconn_find_any_local(
        int i;
 
        if(ip == NULL) {
-               return 0;
+               return NULL;
        }
 
        for(i = 0; i < TCP_ID_HASH_SIZE; i++) {
@@ -1831,7 +1838,7 @@ static struct tcp_connection *_tcpconn_find_any_local(
                }
        }
 
-       return 0;
+       return NULL;
 }
 
 

_______________________________________________
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