提交 b9e57e4d authored 作者: Thomas Mueller's avatar Thomas Mueller

./build.sh testNetwork could block if there was a network configuration problem.

上级 8f55701b
......@@ -628,7 +628,7 @@ public class Build extends BuildBase {
System.out.println(serverSocket);
int port = serverSocket.getLocalPort();
final ServerSocket accept = serverSocket;
new Thread() {
Thread thread = new Thread() {
public void run() {
try {
System.out.println("server accepting");
......@@ -646,9 +646,11 @@ public class Build extends BuildBase {
t.printStackTrace();
}
}
}.start();
};
thread.start();
Thread.sleep(1000);
Socket socket = new Socket();
socket.setSoTimeout(2000);
InetSocketAddress socketAddress = new InetSocketAddress(address, port);
System.out.println("client:" + socketAddress);
try {
......@@ -662,6 +664,12 @@ public class Build extends BuildBase {
} catch (Throwable t) {
t.printStackTrace();
}
thread.join(5000);
if (thread.isAlive()) {
System.out.println("thread is still alive, interrupting");
thread.interrupt();
}
Thread.sleep(100);
System.out.println("done");
} catch (Exception e) {
e.printStackTrace();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论