send P2pAlive if havent heard from the other side for 500ms

This commit is contained in:
DavidVentura
2024-01-29 22:05:53 +01:00
parent c8259c95fa
commit ebb9d8b081
3 changed files with 21 additions and 4 deletions
+2
View File
@@ -12,6 +12,7 @@ export type Session = {
ticket: number[];
eventEmitter: EventEmitter;
dst_ip: string;
lastReceivedPacket: number;
};
export type PacketHandler = (session: Session, dv: DataView, rinfo: RemoteInfo) => void;
@@ -49,6 +50,7 @@ export const makeSession = (cb: msgCb, connCb: connCb, options: opt): Session =>
const session: Session = {
outgoingCommandId: 0,
ticket: [0, 0, 0, 0],
lastReceivedPacket: 0,
eventEmitter: new EventEmitter(),
send: (msg: DataView) => {
const raw = msg.readU16();