8145635: Add TCP_QUICKACK socket option

Reviewed-by: chegar, rriggs, clanger
This commit is contained in:
Vyom Tewari 2017-11-13 14:03:36 +05:30
parent 43006bf8f9
commit 2245db7522
9 changed files with 394 additions and 14 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -85,10 +85,18 @@ class PlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
protected Set<SocketOption<?>> supportedOptions() {
HashSet<SocketOption<?>> options = new HashSet<>(super.supportedOptions());
options.addAll(extendedOptions.options());
addExtSocketOptions(extendedOptions.options(), options);
return options;
}
private void addExtSocketOptions(Set<SocketOption<?>> extOptions,
Set<SocketOption<?>> options) {
// TCP_QUICKACK is applicable for TCP Sockets only.
extOptions.stream()
.filter((option) -> !option.name().equals("TCP_QUICKACK"))
.forEach((option) -> options.add(option));
}
protected void socketSetOption(int opt, Object val) throws SocketException {
if (opt == SocketOptions.SO_REUSEPORT &&
!supportedOptions().contains(StandardSocketOptions.SO_REUSEPORT)) {