Selaa lähdekoodia

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()
(cherry picked from commit a510d17d7005fa47d4f2a672b4ceb94fbda9c9ba)
Daniel-Constantin Mierla 13 vuotta sitten
vanhempi
commit
69c219d958
1 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  1. 5 0
      tcp_read.c

+ 5 - 0
tcp_read.c

@@ -856,8 +856,10 @@ skip:
  * the content of the stream. Safer, make a clone of buf content in a local
  * 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
  * 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)
 int receive_tcp_msg(char* tcpbuf, unsigned int len, struct receive_info* rcv_info)
 {
 {
+#ifdef TCP_CLONE_RCVBUF
 #ifdef DYN_BUF
 #ifdef DYN_BUF
 	char *buf = NULL;
 	char *buf = NULL;
 #else
 #else
@@ -903,6 +905,9 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len, struct receive_info* rcv_inf
 	memcpy(buf, tcpbuf, len);
 	memcpy(buf, tcpbuf, len);
 	buf[len] = '\0';
 	buf[len] = '\0';
 	return receive_msg(buf, len, rcv_info);
 	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)
 int tcp_read_req(struct tcp_connection* con, int* bytes_read, int* read_flags)