Skip to content

Commit

Permalink
feat: Add support for more TCP channel options (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubjanecek authored Jul 7, 2021
1 parent 3a119fc commit 0d2d39b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 0d2d39b

Please sign in to comment.