mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
nasty bugfix: UDPPinger now closes DatagramSockets properly (otherwise large scans result in reaching the limit of number of open files)
git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@149 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
74412a52d6
commit
a7454ba4e9
@ -53,8 +53,7 @@ public class TCPPinger implements Pinger {
|
||||
// TODO: this means that the host is down
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.setLevel(Level.ALL);
|
||||
LOG.log(Level.FINER, null, e);
|
||||
LOG.log(Level.FINER, address.toString(), e);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@ -9,6 +9,7 @@ import java.io.IOException;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NoRouteToHostException;
|
||||
import java.net.PortUnreachableException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.logging.Level;
|
||||
@ -50,12 +51,15 @@ public class UDPPinger implements Pinger {
|
||||
}
|
||||
catch (SocketTimeoutException e) {
|
||||
}
|
||||
catch (NoRouteToHostException e) {
|
||||
// TODO: this means that the host is down
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.log(Level.FINER, null, e);
|
||||
LOG.log(Level.FINER, address.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
socket.disconnect();
|
||||
socket.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user