Skip to content

Commit

Permalink
Optimize calling client_send_plainv when there is only one buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
maximkulkin committed Jan 4, 2021
1 parent a273e19 commit 7cb0512
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,15 @@ void client_sendv(client_context_t *context, uint8_t n, const byte **data, size_
if (context->encrypted) {
client_send_encryptedv(context, n, data, data_sizes);
} else {
client_send_plainv(context, n, data, data_sizes);
if (n == 1) {
int r = write(context->socket, data[0], data_sizes[0]);
if (r < 0) {
CLIENT_ERROR(context, "Failed to send response (errno %d)", errno);
return;
}
} else {
client_send_plainv(context, n, data, data_sizes);
}
}
}

Expand Down

0 comments on commit 7cb0512

Please sign in to comment.