Fix the ability for IPData refcount to go negative
This commit is contained in:
2
cvm-rs/index.d.ts
vendored
2
cvm-rs/index.d.ts
vendored
@@ -80,5 +80,5 @@ js side api:
|
|||||||
remotingMouseEvent(client, x, y, buttons) - mouse event
|
remotingMouseEvent(client, x, y, buttons) - mouse event
|
||||||
|
|
||||||
on the rust side a boxed client will contain an inner boxed `dyn RemotingProtocolClient` which will contain protocol specific dispatch,
|
on the rust side a boxed client will contain an inner boxed `dyn RemotingProtocolClient` which will contain protocol specific dispatch,
|
||||||
upon parsing a remoting URI we will create a given client (e.g, for `vnc://` we'd make the VNC one)
|
upon parsing a remoting URI we will create a given client (e.g: for `vnc://` we'd make the VNC one)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -170,9 +170,6 @@ export default class CollabVMServer {
|
|||||||
this.sendVoteUpdate();
|
this.sendVoteUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unreference the IP data.
|
|
||||||
user.IP.Unref();
|
|
||||||
|
|
||||||
if (this.indefiniteTurn === user) this.indefiniteTurn = null;
|
if (this.indefiniteTurn === user) this.indefiniteTurn = null;
|
||||||
|
|
||||||
this.clients.splice(clientIndex, 1);
|
this.clients.splice(clientIndex, 1);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export class IPData {
|
|||||||
// Call when a connection is closed to "release" the ip data
|
// Call when a connection is closed to "release" the ip data
|
||||||
Unref() {
|
Unref() {
|
||||||
if (this.refCount - 1 < 0) this.refCount = 0;
|
if (this.refCount - 1 < 0) this.refCount = 0;
|
||||||
this.refCount--;
|
else this.refCount--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ export class IPDataManager {
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
for (let tuple of IPDataManager.ipDatas) {
|
for (let tuple of IPDataManager.ipDatas) {
|
||||||
if (tuple[1].refCount == 0) {
|
if (tuple[1].refCount == 0) {
|
||||||
IPDataManager.logger.Info('Deleted ipdata for IP {0}', tuple[0]);
|
IPDataManager.logger.Info('Deleted IPData for IP {0}', tuple[0]);
|
||||||
IPDataManager.ipDatas.delete(tuple[0]);
|
IPDataManager.ipDatas.delete(tuple[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user