Skip to content

net: Track state of setKeepAlive and prevent unnecessary system calls

The state of .setKeepAlive() is now tracked and code will prevent repeated system calls to setsockopt() when the value has already been set to the desired value for the socket.

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Rationale

The reason for this change is that if keep alive is set for a HTTP Agent, there will be repeated calls to net.Socket.setKeepAlive() which in turn will cause many calls to setsockopt() that are unnecessary since the socket has already been set to send keep alive packets.

This is much like #31543

Merge request reports

Loading