s2n-tls icon indicating copy to clipboard operation
s2n-tls copied to clipboard

Enabling multirecord send persists across configs

Open goatgoose opened this issue 6 months ago • 0 comments

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:

  1. Reset conn->multirecord_send to false in s2n_connection_set_config() if the new config's send buffer size wasn't overridden.
  2. Directly use the send_buffer_size_override config flag to enable the multirecord send behavior, rather than tracking it separately on the connection.

goatgoose avatar Aug 19 '24 20:08 goatgoose