s2n-tls
s2n-tls copied to clipboard
Enabling multirecord send persists across configs
Problem:
Multirecord send allows connections to buffer multiple records before sending them, which reduces system write calls. Multirecord send is enabled by adjusting the config's send buffer size with s2n_config_set_send_buffer_size().
Adjusting the config's send buffer size sets the connection's multirecord_send
flag in s2n_connection_set_config(). This flag is never unset, even if a subsequent config with an unmodified send buffer size is set on the connection.
This behavior may be unexpected, since the multirecord send behavior appears to be configured for a config, but is actually configured on the connection itself. It seems more correct to directly associate the multirecord send behavior with the state of the config's send buffer size.
Solution:
Either:
- Reset
conn->multirecord_send
to false ins2n_connection_set_config()
if the new config's send buffer size wasn't overridden. - Directly use the
send_buffer_size_override
config flag to enable the multirecord send behavior, rather than tracking it separately on the connection.