@@ -243,30 +243,31 @@ extension WebSocketServer {
243
243
) -> EventLoopFuture < Channel > {
244
244
245
245
func makeServerBootstrap( ) -> EventLoopFuture < Channel > {
246
- return ServerBootstrap ( group: self . eventloopGroup)
246
+ ServerBootstrap ( group: self . eventloopGroup)
247
247
. serverChannelInitializer { channel in
248
248
logger. info ( " Server is listening on \( resolvedAddress) " )
249
249
if self . eventloopGroup is MultiThreadedEventLoopGroup {
250
250
if configuration. socketReuseAddress,
251
- let syncOptions = channel. syncOptions
251
+ let syncOptions = channel. syncOptions
252
252
{
253
253
do {
254
254
try syncOptions. setOption ( . socketOption( . so_reuseaddr) , value: 1 )
255
255
} catch {
256
256
return channel. eventLoop. makeFailedFuture ( error)
257
257
}
258
258
}
259
-
259
+
260
260
if configuration. socketTcpNoDelay,
261
- let syncOptions = channel. syncOptions {
261
+ let syncOptions = channel. syncOptions
262
+ {
262
263
do {
263
264
try syncOptions. setOption ( . socketOption( . tcp_nodelay) , value: 1 )
264
265
} catch {
265
266
return channel. eventLoop. makeFailedFuture ( error)
266
267
}
267
268
}
268
269
}
269
-
270
+
270
271
if let socketSendBufferSize = configuration. socketSendBufferSize,
271
272
let syncOptions = channel. syncOptions
272
273
{
@@ -306,10 +307,10 @@ extension WebSocketServer {
306
307
307
308
#if canImport(Network)
308
309
func makeNIOTSListenerBootstrap( ) -> EventLoopFuture < Channel > {
309
-
310
+
310
311
let tcpOptions = NWProtocolTCP . Options ( )
311
312
tcpOptions. noDelay = configuration. socketTcpNoDelay
312
-
313
+
313
314
return NIOTSListenerBootstrap ( group: self . eventloopGroup)
314
315
. tcpOptions ( tcpOptions)
315
316
. serverChannelInitializer { channel in
@@ -385,10 +386,11 @@ extension WebSocketServer {
385
386
) -> EventLoopFuture < Void > {
386
387
self . makeBootstrapAndBind ( with: configuration, resolvedAddress: address) { channel in
387
388
logger. debug ( " child channel: \( channel) " )
388
-
389
+
389
390
if self . eventloopGroup is MultiThreadedEventLoopGroup {
390
391
if configuration. socketReuseAddress,
391
- let syncOptions = channel. syncOptions {
392
+ let syncOptions = channel. syncOptions
393
+ {
392
394
do {
393
395
try syncOptions. setOption ( . socketOption( . so_reuseaddr) , value: 1 )
394
396
} catch {
@@ -397,15 +399,16 @@ extension WebSocketServer {
397
399
}
398
400
399
401
if configuration. socketTcpNoDelay,
400
- let syncOptions = channel. syncOptions {
402
+ let syncOptions = channel. syncOptions
403
+ {
401
404
do {
402
405
try syncOptions. setOption ( . socketOption( . tcp_nodelay) , value: 1 )
403
406
} catch {
404
407
return channel. eventLoop. makeFailedFuture ( error)
405
408
}
406
409
}
407
410
}
408
-
411
+
409
412
// enable tls if configuration is provided
410
413
if let tlsConfiguration = configuration. tlsConfiguration {
411
414
guard let sslContext = try ? NIOSSLContext ( configuration: tlsConfiguration) else {
0 commit comments