moov-io / iso8583-connection

:satellite: Go-powered ISO8583 connection handler offering advanced binary framing, message interleaving, and a robust connection pool for load distribution and seamless reconnections.
Apache License 2.0
70 stars 23 forks source link

Add keep-alive and NO_DELAY options to Connection #61

Closed carsonab closed 1 year ago

carsonab commented 1 year ago

This PR adds a KeepAlive option to Connection in order to set the keep-alive options on the underlying TCP connection created by the Dialer.

TCP keep-alive packets are zero length packets (just a header) that can be automatically sent and ACK'd on a TCP connection in order to detect issues with the connection when idle. By default Go's Dialer will create TCP sockets using a keep-alive time and period of 15 seconds. Some network specs include requirements for keep-alive and so require this setting.

Also added a NoDelay setting after some discussion to enable or disable Nagle's algorithm.

carsonab commented 1 year ago

@alovak @adamdecaf went ahead and added a NoDelay after our discussion.

carsonab commented 1 year ago

Closing in favor of using NewFrom() with an existing connection as a catch all for niche options rather than clutter the api with them.