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:
angryziber 2007-07-12 10:48:25 +00:00
parent 74412a52d6
commit a7454ba4e9
2 changed files with 7 additions and 4 deletions

View File

@ -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 {

View File

@ -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;
}