Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
0587dc28
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看板
提交
0587dc28
编写于
8月 11, 2009
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
4516760: (so) Intermittent SocketException: Transport endpoint is not connected (lnx)
Reviewed-by: sherman
上级
1da43f43
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
55 addition
and
16 deletion
+55
-16
src/solaris/native/sun/nio/ch/Net.c
src/solaris/native/sun/nio/ch/Net.c
+1
-1
test/java/nio/channels/SocketChannel/Shutdown.java
test/java/nio/channels/SocketChannel/Shutdown.java
+54
-15
未找到文件。
src/solaris/native/sun/nio/ch/Net.c
浏览文件 @
0587dc28
...
...
@@ -541,7 +541,7 @@ Java_sun_nio_ch_Net_shutdown(JNIEnv *env, jclass cl, jobject fdo, jint jhow)
{
int
how
=
(
jhow
==
sun_nio_ch_Net_SHUT_RD
)
?
SHUT_RD
:
(
jhow
==
sun_nio_ch_Net_SHUT_WR
)
?
SHUT_WR
:
SHUT_RDWR
;
if
(
shutdown
(
fdval
(
env
,
fdo
),
how
)
<
0
)
if
(
(
shutdown
(
fdval
(
env
,
fdo
),
how
)
<
0
)
&&
(
errno
!=
ENOTCONN
)
)
handleSocketError
(
env
,
errno
);
}
...
...
test/java/nio/channels/SocketChannel/Shutdown.java
浏览文件 @
0587dc28
/*
* Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2002
-2009
Sun Microsystems, Inc. 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
...
...
@@ -22,26 +22,65 @@
*/
/* @test
* @bug 4618960
* @summary Test isInputShutdown
* @library ..
* @bug 4618960 4516760
* @summary Test shutdownXXX and isInputShutdown
*/
import
java.io.IOException
;
import
java.net.*
;
import
java.nio.
*
;
import
java.nio.
ByteBuffer
;
import
java.nio.channels.*
;
public
class
Shutdown
{
public
static
void
main
(
String
args
[])
throws
Exception
{
InetSocketAddress
sa
=
new
InetSocketAddress
(
InetAddress
.
getByName
(
TestUtil
.
HOST
),
23
);
SocketChannel
sc
=
SocketChannel
.
open
(
sa
);
boolean
before
=
sc
.
socket
().
isInputShutdown
();
sc
.
socket
().
shutdownInput
();
boolean
after
=
sc
.
socket
().
isInputShutdown
();
sc
.
close
();
if
(
before
||
!
after
)
throw
new
Exception
(
"Test failed"
);
/**
* Accept a connection, and close it immediately causing a hard reset.
*/
static
void
acceptAndReset
(
ServerSocketChannel
ssc
)
throws
IOException
{
SocketChannel
peer
=
ssc
.
accept
();
try
{
peer
.
setOption
(
StandardSocketOption
.
SO_LINGER
,
0
);
peer
.
configureBlocking
(
false
);
peer
.
write
(
ByteBuffer
.
wrap
(
new
byte
[
128
*
1024
]));
}
finally
{
peer
.
close
();
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ServerSocketChannel
ssc
=
ServerSocketChannel
.
open
()
.
bind
(
new
InetSocketAddress
(
0
));
try
{
InetAddress
lh
=
InetAddress
.
getLocalHost
();
int
port
=
((
InetSocketAddress
)(
ssc
.
getLocalAddress
())).
getPort
();
SocketAddress
remote
=
new
InetSocketAddress
(
lh
,
port
);
// Test SocketChannel shutdownXXX
SocketChannel
sc
;
sc
=
SocketChannel
.
open
(
remote
);
try
{
acceptAndReset
(
ssc
);
sc
.
shutdownInput
();
sc
.
shutdownOutput
();
}
finally
{
sc
.
close
();
}
// Test Socket adapter shutdownXXX and isShutdownInput
sc
=
SocketChannel
.
open
(
remote
);
try
{
acceptAndReset
(
ssc
);
boolean
before
=
sc
.
socket
().
isInputShutdown
();
sc
.
socket
().
shutdownInput
();
boolean
after
=
sc
.
socket
().
isInputShutdown
();
if
(
before
||
!
after
)
throw
new
RuntimeException
(
"Before and after test failed"
);
sc
.
socket
().
shutdownOutput
();
}
finally
{
sc
.
close
();
}
}
finally
{
ssc
.
close
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录