[sr-dev] git:master: core/tcp: define option TCP_CLONE_RCVBUF to turn off/ on tcp rcv buffer cloning

Daniel-Constantin Mierla miconda at gmail.com
Wed Dec 21 10:04:13 CET 2011


Module: sip-router
Branch: master
Commit: a510d17d7005fa47d4f2a672b4ceb94fbda9c9ba
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a510d17d7005fa47d4f2a672b4ceb94fbda9c9ba

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Dec 20 22:34:26 2011 +0100

core/tcp: define option TCP_CLONE_RCVBUF to turn off/on tcp rcv buffer cloning

- cloning is on by default, to be safe for topoh and msg_apply_changes()

---

 tcp_read.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/tcp_read.c b/tcp_read.c
index c180301..c86a2dd 100644
--- a/tcp_read.c
+++ b/tcp_read.c
@@ -856,8 +856,10 @@ skip:
  * the content of the stream. Safer, make a clone of buf content in a local
  * buffer and give that to receive_msg() to link to msg->buf
  */
+#define TCP_CLONE_RCVBUF
 int receive_tcp_msg(char* tcpbuf, unsigned int len, struct receive_info* rcv_info)
 {
+#ifdef TCP_CLONE_RCVBUF
 #ifdef DYN_BUF
 	char *buf = NULL;
 #else
@@ -903,6 +905,9 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len, struct receive_info* rcv_inf
 	memcpy(buf, tcpbuf, len);
 	buf[len] = '\0';
 	return receive_msg(buf, len, rcv_info);
+#else /* TCP_CLONE_RCVBUF */
+	return receive_msg(tcpbuf, len, rcv_info);
+#endif /* TCP_CLONE_RCVBUF */
 }
 
 int tcp_read_req(struct tcp_connection* con, int* bytes_read, int* read_flags)




More information about the sr-dev mailing list