1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 04:42:40 +01:00

Aphlict - remove listeners when clients close the connection

Summary: Ref T7110. Listeners are now removed when clients close the connection to avoid stacking a never ending number of unused listeners.

Test Plan: Using `wscat` to connect to the Aphlict server; when closing the connection a 'Diconnected.' will appear in the logs and the number of active listeners is decreased by one.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7110

Differential Revision: https://secure.phabricator.com/D11634
This commit is contained in:
Pierre Moreau 2015-02-02 14:56:15 -08:00 committed by epriestley
parent 0969b0d8c8
commit 4af1fd2a79

View file

@ -69,6 +69,11 @@ JX.install('AphlictClientServer', {
} }
}); });
ws.on('close', function() {
self.getListenerList().removeListener(listener);
log('Disconnected.');
});
wss.on('close', function() { wss.on('close', function() {
self.getListenerList().removeListener(listener); self.getListenerList().removeListener(listener);
log('Disconnected.'); log('Disconnected.');