equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 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 |
296 private static Set<SocketOption<?>> defaultOptions() { |
296 private static Set<SocketOption<?>> defaultOptions() { |
297 HashSet<SocketOption<?>> set = new HashSet<>(8); |
297 HashSet<SocketOption<?>> set = new HashSet<>(8); |
298 set.add(StandardSocketOptions.SO_SNDBUF); |
298 set.add(StandardSocketOptions.SO_SNDBUF); |
299 set.add(StandardSocketOptions.SO_RCVBUF); |
299 set.add(StandardSocketOptions.SO_RCVBUF); |
300 set.add(StandardSocketOptions.SO_REUSEADDR); |
300 set.add(StandardSocketOptions.SO_REUSEADDR); |
|
301 if (Net.isReusePortAvailable()) { |
|
302 set.add(StandardSocketOptions.SO_REUSEPORT); |
|
303 } |
301 set.add(StandardSocketOptions.SO_BROADCAST); |
304 set.add(StandardSocketOptions.SO_BROADCAST); |
302 set.add(StandardSocketOptions.IP_TOS); |
305 set.add(StandardSocketOptions.IP_TOS); |
303 set.add(StandardSocketOptions.IP_MULTICAST_IF); |
306 set.add(StandardSocketOptions.IP_MULTICAST_IF); |
304 set.add(StandardSocketOptions.IP_MULTICAST_TTL); |
307 set.add(StandardSocketOptions.IP_MULTICAST_TTL); |
305 set.add(StandardSocketOptions.IP_MULTICAST_LOOP); |
308 set.add(StandardSocketOptions.IP_MULTICAST_LOOP); |