Fix UDP conn request promise rejection warning
This commit is contained in:
1 parent
02e09dfdab
commit
3b36cefbca
1 file changed
+5
-9
@@ -145,7 +145,7 @@ export async function connectionRequest(
|
|||||||
|
|
||||||
const debug = !!getConfig(snapshot, "cwmp.debug", {}, now, evalCallback);
|
const debug = !!getConfig(snapshot, "cwmp.debug", {}, now, evalCallback);
|
||||||
|
|
||||||
let udpProm: Promise<void>;
|
let udpProm = Promise.resolve(false);
|
||||||
if (udpConnectionRequestAddress) {
|
if (udpConnectionRequestAddress) {
|
||||||
try {
|
try {
|
||||||
const u = new URL("udp://" + udpConnectionRequestAddress);
|
const u = new URL("udp://" + udpConnectionRequestAddress);
|
||||||
@@ -156,6 +156,9 @@ export async function connectionRequest(
|
|||||||
UDP_CONNECTION_REQUEST_PORT,
|
UDP_CONNECTION_REQUEST_PORT,
|
||||||
debug,
|
debug,
|
||||||
deviceId
|
deviceId
|
||||||
|
).then(
|
||||||
|
() => true,
|
||||||
|
() => false
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Ignore invalid address
|
// Ignore invalid address
|
||||||
@@ -171,14 +174,7 @@ export async function connectionRequest(
|
|||||||
deviceId
|
deviceId
|
||||||
);
|
);
|
||||||
|
|
||||||
if (udpProm) {
|
if (await udpProm) return "";
|
||||||
try {
|
|
||||||
await udpProm;
|
|
||||||
return "";
|
|
||||||
} catch (err) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user