Commit 115ed191 authored by Oran Agra's avatar Oran Agra Committed by antirez
Browse files

avoid using sendfile if tls-replication is enabled

this obviously broke the tests, but went unnoticed so far since tls
wasn't often tested.
parent 11c748aa
...@@ -1035,8 +1035,12 @@ void sendBulkToSlave(connection *conn) { ...@@ -1035,8 +1035,12 @@ void sendBulkToSlave(connection *conn) {
} }
} }
/* If the preamble was already transferred, send the RDB bulk data. */ /* If the preamble was already transferred, send the RDB bulk data.
* try to use sendfile system call if supported, unless tls is enabled.
* fallback to normal read+write otherwise. */
nwritten = 0;
#if HAVE_SENDFILE #if HAVE_SENDFILE
if (!server.tls_replication) {
if ((nwritten = redis_sendfile(conn->fd,slave->repldbfd, if ((nwritten = redis_sendfile(conn->fd,slave->repldbfd,
slave->repldboff,PROTO_IOBUF_LEN)) == -1) slave->repldboff,PROTO_IOBUF_LEN)) == -1)
{ {
...@@ -1047,7 +1051,9 @@ void sendBulkToSlave(connection *conn) { ...@@ -1047,7 +1051,9 @@ void sendBulkToSlave(connection *conn) {
} }
return; return;
} }
#else }
#endif
if (!nwritten) {
ssize_t buflen; ssize_t buflen;
char buf[PROTO_IOBUF_LEN]; char buf[PROTO_IOBUF_LEN];
...@@ -1067,7 +1073,8 @@ void sendBulkToSlave(connection *conn) { ...@@ -1067,7 +1073,8 @@ void sendBulkToSlave(connection *conn) {
} }
return; return;
} }
#endif }
slave->repldboff += nwritten; slave->repldboff += nwritten;
server.stat_net_output_bytes += nwritten; server.stat_net_output_bytes += nwritten;
if (slave->repldboff == slave->repldbsize) { if (slave->repldboff == slave->repldbsize) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment