Module: kamailio Branch: master Commit: 6310554dec4066ec5bf2796f1fd05c634c9e912a URL: https://github.com/kamailio/kamailio/commit/6310554dec4066ec5bf2796f1fd05c634c9e912a
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2026-03-03T13:37:20+01:00 core: tcp - flag to skip reading data on tcp connection --- Modified: src/core/tcp_conn.h Modified: src/core/tcp_read.c Modified: src/core/tcp_read.h --- Diff: https://github.com/kamailio/kamailio/commit/6310554dec4066ec5bf2796f1fd05c634c9e912a.diff Patch: https://github.com/kamailio/kamailio/commit/6310554dec4066ec5bf2796f1fd05c634c9e912a.patch --- diff --git a/src/core/tcp_conn.h b/src/core/tcp_conn.h index cd1889c7a79..b58b5a76754 100644 --- a/src/core/tcp_conn.h +++ b/src/core/tcp_conn.h @@ -65,6 +65,7 @@ #define F_CONN_PASSIVE 16384 /* conn. created via accept() and not connect()*/ #define F_CONN_CLOSE_EV 32768 /* explicitely call tcpops ev route when closed */ #define F_CONN_NOSEND 65536 /* do not send data on this connection */ +#define F_CONN_NORECV (1 << 17) /* do not receive data on this connection */ #ifndef NO_READ_HTTP11 #define READ_HTTP11 diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c index 211571cf1c4..3a995936093 100644 --- a/src/core/tcp_read.c +++ b/src/core/tcp_read.c @@ -529,12 +529,16 @@ int tcp_read_headers(struct tcp_connection *c, rd_conn_flags_t *read_flags) if(unlikely(r->parsed < r->pos)) { bytes = 0; } else { + if(unlikely(c->flags & F_CONN_NORECV)) { + bytes = 0; + } else { #ifdef USE_TLS - if(unlikely(c->type == PROTO_TLS)) - bytes = tls_read(c, read_flags); - else + if(unlikely(c->type == PROTO_TLS)) + bytes = tls_read(c, read_flags); + else #endif - bytes = tcp_read(c, read_flags); + bytes = tcp_read(c, read_flags); + } if(bytes <= 0) return bytes; gettimeofday(&tvnow, NULL); diff --git a/src/core/tcp_read.h b/src/core/tcp_read.h index 80b3adc02c2..22d5facaeb6 100644 --- a/src/core/tcp_read.h +++ b/src/core/tcp_read.h @@ -34,6 +34,8 @@ typedef enum rd_conn_flags RD_CONN_FORCE_EOF = (1 << 16), } rd_conn_flags_t; +int tcp_read_headers(struct tcp_connection *c, rd_conn_flags_t *read_flags); + int tcp_read_data(int fd, struct tcp_connection *c, char *buf, int b_size, rd_conn_flags_t *flags); _______________________________________________ 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!
