common: fix closeQuiet to actually be quiet

This commit is contained in:
Koushik Dutta
2022-11-15 20:00:55 -08:00
parent f9ddb7aa94
commit fb2f34bf4f
2 changed files with 10 additions and 3 deletions

View File

@@ -6,7 +6,14 @@ export async function closeQuiet(socket: dgram.Socket | net.Server) {
if (!socket)
return;
try {
await new Promise(resolve => socket.close(resolve));
await new Promise((r, f) => {
try {
socket.close(r);
}
catch (e) {
f(e);
}
});
}
catch (e) {
}

View File

@@ -943,8 +943,8 @@ export class RtspServer {
const rtpServer = await createBindZero();
const rtcpServer = await createBindUdp(rtpServer.port + 1);
this.client.on('close', () => rtpServer.server.close())
this.client.on('close', () => rtcpServer.server.close())
this.client.on('close', () => closeQuiet(rtpServer.server));
this.client.on('close', () => closeQuiet(rtcpServer.server));
this.setupTracks[msection.control] = {
control: msection.control,
protocol: 'udp',