equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
232 HashSet<SocketOption<?>> set = new HashSet<>(8); |
232 HashSet<SocketOption<?>> set = new HashSet<>(8); |
233 set.add(StandardSocketOptions.SO_SNDBUF); |
233 set.add(StandardSocketOptions.SO_SNDBUF); |
234 set.add(StandardSocketOptions.SO_RCVBUF); |
234 set.add(StandardSocketOptions.SO_RCVBUF); |
235 set.add(StandardSocketOptions.SO_KEEPALIVE); |
235 set.add(StandardSocketOptions.SO_KEEPALIVE); |
236 set.add(StandardSocketOptions.SO_REUSEADDR); |
236 set.add(StandardSocketOptions.SO_REUSEADDR); |
|
237 if (Net.isReusePortAvailable()) { |
|
238 set.add(StandardSocketOptions.SO_REUSEPORT); |
|
239 } |
237 set.add(StandardSocketOptions.SO_LINGER); |
240 set.add(StandardSocketOptions.SO_LINGER); |
238 set.add(StandardSocketOptions.TCP_NODELAY); |
241 set.add(StandardSocketOptions.TCP_NODELAY); |
239 // additional options required by socket adaptor |
242 // additional options required by socket adaptor |
240 set.add(StandardSocketOptions.IP_TOS); |
243 set.add(StandardSocketOptions.IP_TOS); |
241 set.add(ExtendedSocketOption.SO_OOBINLINE); |
244 set.add(ExtendedSocketOption.SO_OOBINLINE); |