configure timeout

This commit is contained in:
David Ventura
2024-05-07 12:06:46 +02:00
parent 2facd91fb5
commit 04fb1a8e4c
2 changed files with 6 additions and 7 deletions
+4 -4
View File
@@ -61,6 +61,7 @@ export const makeSession = (
dev: DevSerial,
ra: RemoteInfo,
onLogin: (s: Session) => void,
timeoutMs: number,
): Session => {
let unackedDrw = {};
const sock = createSocket("udp4");
@@ -86,8 +87,7 @@ export const makeSession = (
let buf = create_P2pAlive();
session.send(buf);
}
if (delta > 9000) {
// should depend on whether we are streaming video
if (delta > timeoutMs) {
logger.warning(`Camera ${session.devName} timed out`);
session.eventEmitter.emit("disconnect");
}
@@ -161,9 +161,9 @@ export const makeSession = (
return session;
};
export const configureWifi = (ssid: string, password: string) => {
export const configureWifi = (ssid: string, password: string, channel: number) => {
return (s: Session) => {
[SendWifiDetails(s, ssid, password, true)].forEach(s.send);
[SendWifiDetails(s, ssid, password, channel, true)].forEach(s.send);
};
};