Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3011c0e5
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3011c0e5
编写于
4月 16, 2013
作者:
C
chegar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8012244: java/net/Socket/asyncClose/Race.java fails intermittently on Windows
Reviewed-by: alanb, dsamersoff
上级
42643327
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
30 deletion
+34
-30
src/windows/classes/java/net/DualStackPlainSocketImpl.java
src/windows/classes/java/net/DualStackPlainSocketImpl.java
+2
-1
src/windows/native/java/net/SocketInputStream.c
src/windows/native/java/net/SocketInputStream.c
+29
-26
test/java/net/Socket/asyncClose/Race.java
test/java/net/Socket/asyncClose/Race.java
+3
-3
未找到文件。
src/windows/classes/java/net/DualStackPlainSocketImpl.java
浏览文件 @
3011c0e5
...
...
@@ -152,8 +152,9 @@ class DualStackPlainSocketImpl extends AbstractPlainSocketImpl
if
(!
fd
.
valid
())
return
;
close0
(
fdAccess
.
get
(
fd
)
);
final
int
nativefd
=
fdAccess
.
get
(
fd
);
fdAccess
.
set
(
fd
,
-
1
);
close0
(
nativefd
);
}
void
socketShutdown
(
int
howto
)
throws
IOException
{
...
...
src/windows/native/java/net/SocketInputStream.c
浏览文件 @
3011c0e5
...
...
@@ -134,32 +134,35 @@ Java_java_net_SocketInputStream_socketRead0(JNIEnv *env, jobject this,
(
*
env
)
->
SetByteArrayRegion
(
env
,
data
,
off
,
nread
,
(
jbyte
*
)
bufP
);
}
else
{
if
(
nread
<
0
)
{
/*
* Recv failed.
*/
switch
(
WSAGetLastError
())
{
case
WSAEINTR
:
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"socket closed"
);
break
;
case
WSAECONNRESET
:
case
WSAESHUTDOWN
:
/*
* Connection has been reset - Windows sometimes reports
* the reset as a shutdown error.
*/
JNU_ThrowByName
(
env
,
"sun/net/ConnectionResetException"
,
""
);
break
;
case
WSAETIMEDOUT
:
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketTimeoutException"
,
"Read timed out"
);
break
;
default:
NET_ThrowCurrent
(
env
,
"recv failed"
);
// Check if the socket has been closed since we last checked.
// This could be a reason for recv failing.
if
((
*
env
)
->
GetIntField
(
env
,
fdObj
,
IO_fd_fdID
)
==
-
1
)
{
NET_ThrowSocketException
(
env
,
"Socket closed"
);
}
else
{
switch
(
WSAGetLastError
())
{
case
WSAEINTR
:
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"socket closed"
);
break
;
case
WSAECONNRESET
:
case
WSAESHUTDOWN
:
/*
* Connection has been reset - Windows sometimes reports
* the reset as a shutdown error.
*/
JNU_ThrowByName
(
env
,
"sun/net/ConnectionResetException"
,
""
);
break
;
case
WSAETIMEDOUT
:
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketTimeoutException"
,
"Read timed out"
);
break
;
default:
NET_ThrowCurrent
(
env
,
"recv failed"
);
}
}
}
}
...
...
test/java/net/Socket/asyncClose/Race.java
浏览文件 @
3011c0e5
...
...
@@ -23,8 +23,8 @@
/*
* @test
* @bug 8006395
* @summary
Race in async socket close on Linux
* @bug 8006395
8012244
* @summary
Tests racing code that reads and closes a Socket
*/
import
java.io.InputStream
;
...
...
@@ -58,7 +58,7 @@ public class Race {
Thread
.
sleep
(
50
);
}
catch
(
Exception
x
)
{
if
(!(
x
instanceof
SocketException
&&
x
.
getMessage
().
equals
(
"S
ocket closed"
)))
&&
x
.
getMessage
().
equals
IgnoreCase
(
"s
ocket closed"
)))
x
.
printStackTrace
();
// ok, expect Socket closed
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录