mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8280241: (aio) AsynchronousSocketChannel init fails in IPv6 only Windows env
Reviewed-by: dfuchs, alanb
This commit is contained in:
parent
28796cbd1d
commit
36fbec78be
2 changed files with 10 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2022, 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
|
||||
|
@ -69,6 +69,10 @@ Java_sun_nio_ch_WindowsAsynchronousServerSocketChannelImpl_initIDs(JNIEnv* env,
|
|||
DWORD dwBytes;
|
||||
|
||||
s = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (s == INVALID_SOCKET && WSAGetLastError() == WSAEAFNOSUPPORT) {
|
||||
/* IPv4 unavailable... try IPv6 instead */
|
||||
s = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
}
|
||||
if (s == INVALID_SOCKET) {
|
||||
JNU_ThrowIOExceptionWithLastError(env, "socket failed");
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2022, 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
|
||||
|
@ -66,6 +66,10 @@ Java_sun_nio_ch_WindowsAsynchronousSocketChannelImpl_initIDs(JNIEnv* env, jclass
|
|||
DWORD dwBytes;
|
||||
|
||||
s = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (s == INVALID_SOCKET && WSAGetLastError() == WSAEAFNOSUPPORT) {
|
||||
/* IPv4 unavailable... try IPv6 instead */
|
||||
s = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
}
|
||||
if (s == INVALID_SOCKET) {
|
||||
JNU_ThrowIOExceptionWithLastError(env, "socket failed");
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue