Skip to content

Commit 6c7f330

Browse files
committed
Make SO_REUSEPORT lazy loaded
1 parent c063029 commit 6c7f330

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

io/jvm-native/src/main/scala/fs2/io/net/SocketOptionPlatform.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ private[net] trait SocketOptionCompanionPlatform {
7272
def reuseAddress(value: Boolean): SocketOption =
7373
boolean(ReuseAddress, value)
7474

75-
val ReusePort = StandardSocketOptions.SO_REUSEPORT
75+
// Note: this option was added in Java 9 so lazily load it to avoid failure on Java 8
76+
lazy val ReusePort = StandardSocketOptions.SO_REUSEPORT
7677
def reusePort(value: Boolean): SocketOption =
7778
boolean(ReusePort, value)
7879

@@ -97,6 +98,4 @@ private[net] trait SocketOptionCompanionPlatform {
9798
}
9899
def unixServerSocketDeleteOnClose(value: Boolean): SocketOption =
99100
boolean(UnixServerSocketDeleteOnClose, value)
100-
101-
// TODO SO_PEERCRED
102101
}

0 commit comments

Comments
 (0)