diff --git a/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerConfig.scala b/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerConfig.scala index f34423f3..8fcbab33 100644 --- a/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerConfig.scala +++ b/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerConfig.scala @@ -27,6 +27,11 @@ object Http4sBlazeServerConfig { def localhost8080: Http4sBlazeServerConfig = Http4sBlazeServerConfig("127.0.0.1", 8080) - final case class SocketOptions(tcpNoDelay: Boolean = true) + final case class SocketOptions( + tcpNoDelay: Boolean = true, + soKeepAlive: Boolean = true, + soReuseAddr: Boolean = true, + soReusePort: Boolean = true + ) } diff --git a/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerModule.scala b/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerModule.scala index 13afe144..90a2b222 100644 --- a/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerModule.scala +++ b/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerModule.scala @@ -42,6 +42,9 @@ object Http4sBlazeServerModule { .withConnectorPoolSize(config.connectorPoolSize) .withMaxConnections(config.maxConnections) .withChannelOption[java.lang.Boolean](StandardSocketOptions.TCP_NODELAY, config.socketOptions.tcpNoDelay) + .withChannelOption[java.lang.Boolean](StandardSocketOptions.SO_KEEPALIVE, config.socketOptions.soKeepAlive) + .withChannelOption[java.lang.Boolean](StandardSocketOptions.SO_REUSEADDR, config.socketOptions.soReuseAddr) + .withChannelOption[java.lang.Boolean](StandardSocketOptions.SO_REUSEPORT, config.socketOptions.soReusePort) .resource } yield server }