Browse code

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()

Daniel-Constantin Mierla authored on 20/12/2011 21:34:26
Showing 1 changed files
... ...
@@ -856,8 +856,10 @@ skip:
856 856
  * the content of the stream. Safer, make a clone of buf content in a local
857 857
  * buffer and give that to receive_msg() to link to msg->buf
858 858
  */
859
+#define TCP_CLONE_RCVBUF
859 860
 int receive_tcp_msg(char* tcpbuf, unsigned int len, struct receive_info* rcv_info)
860 861
 {
862
+#ifdef TCP_CLONE_RCVBUF
861 863
 #ifdef DYN_BUF
862 864
 	char *buf = NULL;
863 865
 #else
... ...
@@ -903,6 +905,9 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len, struct receive_info* rcv_inf
903 903
 	memcpy(buf, tcpbuf, len);
904 904
 	buf[len] = '\0';
905 905
 	return receive_msg(buf, len, rcv_info);
906
+#else /* TCP_CLONE_RCVBUF */
907
+	return receive_msg(tcpbuf, len, rcv_info);
908
+#endif /* TCP_CLONE_RCVBUF */
906 909
 }
907 910
 
908 911
 int tcp_read_req(struct tcp_connection* con, int* bytes_read, int* read_flags)