Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(response, peer) => {
let request = this.findRequest(response);
let endpoint = this.endpoints[peer];
if (!request || !endpoint) {
this.transport.sendReset(response, peer);
return;
}
if (response.type == Type.Con) {
this.transport.sendAck(response, peer);
}
if (response.type === Type.Ack) {
if (!request['ack']) {
request['ack'] = Date.now();
if (request.onAck) {
request.onAck();
} else if (this.onAck) {
this.onAck(request);
}
endpoint.dequeue(request);
}
}