8231259: (dc) DatagramChannel::disconnect re-binds socket to the wildcard address (macOS)

Reviewed-by: dfuchs, chegar
This commit is contained in:
Alan Bateman 2019-11-20 08:35:53 +00:00
parent 62d6862485
commit 7e42642939
11 changed files with 494 additions and 146 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2019, 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
@ -25,16 +25,16 @@
package sun.nio.ch;
import java.io.*;
import java.net.*;
import java.io.FileDescriptor;
import java.io.IOException;
/**
* Allows different platforms to call different native methods
* for read and write operations.
*/
class DatagramDispatcher extends NativeDispatcher
{
class DatagramDispatcher extends NativeDispatcher {
static {
IOUtil.load();
}
@ -63,6 +63,10 @@ class DatagramDispatcher extends NativeDispatcher
FileDispatcherImpl.preClose0(fd);
}
void dup(FileDescriptor fd1, FileDescriptor fd2) throws IOException {
FileDispatcherImpl.dup0(fd1, fd2);
}
static native int read0(FileDescriptor fd, long address, int len)
throws IOException;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, 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
@ -108,6 +108,10 @@ class FileDispatcherImpl extends FileDispatcher {
preClose0(fd);
}
void dup(FileDescriptor fd1, FileDescriptor fd2) throws IOException {
dup0(fd1, fd2);
}
FileDescriptor duplicateForMapping(FileDescriptor fd) {
// file descriptor not required for mapping operations; okay
// to return invalid file descriptor.
@ -176,6 +180,8 @@ class FileDispatcherImpl extends FileDispatcher {
static native void preClose0(FileDescriptor fd) throws IOException;
static native void dup0(FileDescriptor fd1, FileDescriptor fd2) throws IOException;
static native void closeIntFD(int fd) throws IOException;
static native int setDirect0(FileDescriptor fd) throws IOException;