Simply return null if no response received instead of crashing

This commit is contained in:
Muaz Ahmad 2024-05-17 23:49:56 +05:00
parent 1bdcb150b1
commit 43411dbc8f

View file

@ -115,7 +115,7 @@ fn receive_response(sock: socket, ip_info: util.IPInfo) !util.IP {
const n: usize = blk: {
const ret = std.c.recv(sock, &buff, MSG_BUFF_SIZE, 0);
if (ret < 0) {
return MDNSError.UDPRecvFail;
return util.IP{}; // no reply means no matching record on network
} else {
break :blk @bitCast(ret);
}