Skip to content

Commit f51211c

Browse files
committed
chore: Set reuseAddr by default for undertow.
1 parent 05ca192 commit f51211c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cask/src/cask/main/Main.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import cask.model._
66
import cask.router.{Decorator, EndpointMetadata, EntryPoint, Result}
77
import cask.util.Logger
88
import io.undertow.Undertow
9-
import io.undertow.server.handlers.BlockingHandler
109
import io.undertow.server.{HttpHandler, HttpServerExchange}
10+
import io.undertow.server.handlers.BlockingHandler
1111
import io.undertow.util.HttpString
12+
import org.xnio.Options
1213

1314
import java.util.concurrent.ExecutorService
1415

@@ -87,6 +88,9 @@ abstract class Main{
8788
if (!verbose) Main.silenceJboss()
8889
val server = Undertow.builder
8990
.addHttpListener(port, host)
91+
.setSocketOption(Options.REUSE_ADDRESSES, java.lang.Boolean.TRUE)
92+
.setSocketOption(Options.TCP_NODELAY, java.lang.Boolean.TRUE)
93+
.setSocketOption(Options.USE_DIRECT_BUFFERS, java.lang.Boolean.TRUE)
9094
.setHandler(defaultHandler)
9195
.build
9296
server.start()

0 commit comments

Comments
 (0)