Fixed service unexpectedly stop

This commit is contained in:
PeratX 2017-05-29 20:02:57 +08:00
parent 9919375111
commit 0b3f5e671a

View File

@ -235,10 +235,14 @@ public class UdpDnsProvider extends DnsProvider {
} }
private void handleRawDnsResponse(IpPacket parsedPacket, DatagramSocket dnsSocket) throws IOException { private void handleRawDnsResponse(IpPacket parsedPacket, DatagramSocket dnsSocket) throws IOException {
byte[] datagramData = new byte[1024]; try {
DatagramPacket replyPacket = new DatagramPacket(datagramData, datagramData.length); byte[] datagramData = new byte[1024];
dnsSocket.receive(replyPacket); DatagramPacket replyPacket = new DatagramPacket(datagramData, datagramData.length);
handleDnsResponse(parsedPacket, datagramData); dnsSocket.receive(replyPacket);
handleDnsResponse(parsedPacket, datagramData);
} catch (Exception e) {
Logger.logException(e);
}
} }