Simply return null if no response received instead of crashing
This commit is contained in:
parent
1bdcb150b1
commit
43411dbc8f
1 changed files with 1 additions and 1 deletions
|
@ -115,7 +115,7 @@ fn receive_response(sock: socket, ip_info: util.IPInfo) !util.IP {
|
||||||
const n: usize = blk: {
|
const n: usize = blk: {
|
||||||
const ret = std.c.recv(sock, &buff, MSG_BUFF_SIZE, 0);
|
const ret = std.c.recv(sock, &buff, MSG_BUFF_SIZE, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return MDNSError.UDPRecvFail;
|
return util.IP{}; // no reply means no matching record on network
|
||||||
} else {
|
} else {
|
||||||
break :blk @bitCast(ret);
|
break :blk @bitCast(ret);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue