Skip to content

Commit

Permalink
fix(ws-server): delete handshake on clientIP update
Browse files Browse the repository at this point in the history
  • Loading branch information
Itokoyamato committed Mar 10, 2021
1 parent e4bcce7 commit efbb4c5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ws_server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ io.on('connection', async socket => {
socketHeartbeat(socket);
socket.on('updateClientIP', data => {
if (!data || !data.ip || !IPv4Regex.test(data.ip) || !clients[socket.uuid]) return;
if (lodash.get(clients, `[${socket.uuid}].fivem.socket`)) clients[socket.uuid].fivem.socket.clientIp = data.ip;
if (lodash.get(clients, `[${socket.uuid}].fivem.socket`)) {
delete handshakes[clients[socket.uuid].fivem.socket.clientIp];
clients[socket.uuid].fivem.socket.clientIp = data.ip;
}
if (lodash.get(clients, `[${socket.uuid}].ts3.socket`)) clients[socket.uuid].ts3.socket.clientIp = data.ip;
});
await registerHandshake(socket);
Expand Down

1 comment on commit efbb4c5

@Nizzy-crrp
Copy link

@Nizzy-crrp Nizzy-crrp commented on efbb4c5 Mar 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working

Please sign in to comment.