Skip to content

Commit

Permalink
chore: Set reuseAddr by default for undertow.
Browse files Browse the repository at this point in the history
  • Loading branch information
He-Pin committed Jan 18, 2025
1 parent 78031f7 commit 7b3f55c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cask/src/cask/main/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import io.undertow.Undertow
import io.undertow.server.{HttpHandler, HttpServerExchange}
import io.undertow.server.handlers.BlockingHandler
import io.undertow.util.HttpString
import org.xnio.Options

import scala.concurrent.ExecutionContext

Expand Down Expand Up @@ -65,6 +66,9 @@ abstract class Main{
if (!verbose) Main.silenceJboss()
val server = Undertow.builder
.addHttpListener(port, host)
.setSocketOption(Options.REUSE_ADDRESSES, true)
.setSocketOption(Options.TCP_NODELAY, true)
.setSocketOption(Options.USE_DIRECT_BUFFERS, true)
.setHandler(defaultHandler)
.build
server.start()
Expand Down

0 comments on commit 7b3f55c

Please sign in to comment.