提交 e5ea70c7 编写于 作者: K Kohsuke Kawaguchi

make sure the socket is closed

上级 7110ddb7
......@@ -212,14 +212,7 @@ public class ManagedWindowsServiceLauncher extends ComputerLauncher {
// // continue anyway, just in case it's just ICMP that's getting filtered
// }
try {
Socket s = new Socket();
s.connect(new InetSocketAddress(host,135),5000);
s.close();
} catch (IOException e) {
logger.println("Failed to connect to port 135 of "+name+". Is Windows firewall blocking this port? Or did you disable DCOM service?");
// again, let it continue.
}
checkPort135Access(logger, name, host);
JIDefaultAuthInfoImpl auth = createAuth();
JISession session = JISession.createSession(auth);
......@@ -386,6 +379,18 @@ public class ManagedWindowsServiceLauncher extends ComputerLauncher {
}
}
private void checkPort135Access(PrintStream logger, String name, InetAddress host) throws IOException {
Socket s = new Socket();
try {
s.connect(new InetSocketAddress(host,135),5000);
} catch (IOException e) {
logger.println("Failed to connect to port 135 of "+name+". Is Windows firewall blocking this port? Or did you disable DCOM service?");
// again, let it continue.
} finally {
s.close();
}
}
/**
* Determines the host name (or the IP address) to connect to.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册