avoid using sendfile if tls-replication is enabled

this obviously broke the tests, but went unnoticed so far since tls
wasn't often tested.
This commit is contained in:
Oran Agra 2020-05-26 13:50:59 +03:00
parent b89e6d74fa
commit b9abecfc4c
1 changed files with 36 additions and 29 deletions

View File

@ -1032,8 +1032,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 (!server.tls_replication) {
if ((nwritten = redis_sendfile(conn->fd,slave->repldbfd,
slave->repldboff,PROTO_IOBUF_LEN)) == -1)
{
@ -1044,7 +1048,9 @@ void sendBulkToSlave(connection *conn) {
}
return;
}
#else
}
#endif
if (!nwritten) {
ssize_t buflen;
char buf[PROTO_IOBUF_LEN];
@ -1064,7 +1070,8 @@ void sendBulkToSlave(connection *conn) {
}
return;
}
#endif
}
slave->repldboff += nwritten;
server.stat_net_output_bytes += nwritten;
if (slave->repldboff == slave->repldbsize) {