Commit 886c11aa authored by Leo Iannacone's avatar Leo Iannacone

prevent memory leak

parent dd4f26e3
...@@ -137,6 +137,7 @@ function Client(socket) { ...@@ -137,6 +137,7 @@ function Client(socket) {
return; return;
var distribution_path = path.join(config.debomatic.path, data.distribution.name, 'pool'); var distribution_path = path.join(config.debomatic.path, data.distribution.name, 'pool');
utils.generic_handler_watcher(_e.distribution_packages, socket, data, distribution_path, __send_distribution_packages); utils.generic_handler_watcher(_e.distribution_packages, socket, data, distribution_path, __send_distribution_packages);
data = null;
}); });
socket.on(_e.package_files_list, function (data) { socket.on(_e.package_files_list, function (data) {
...@@ -144,18 +145,21 @@ function Client(socket) { ...@@ -144,18 +145,21 @@ function Client(socket) {
return; return;
var package_path = utils.get_package_path(data); var package_path = utils.get_package_path(data);
utils.generic_handler_watcher(_e.package_files_list, socket, data, package_path, __send_package_files_list); utils.generic_handler_watcher(_e.package_files_list, socket, data, package_path, __send_package_files_list);
data = null;
}); });
socket.on(_e.file, function (data) { socket.on(_e.file, function (data) {
if (!utils.check_data_file(data)) if (!utils.check_data_file(data))
return; return;
__handler_get_file(socket, data); __handler_get_file(socket, data);
data = null;
}); });
socket.on(_e.package_info, function (data) { socket.on(_e.package_info, function (data) {
if (!utils.check_data_package(data)) if (!utils.check_data_package(data))
return; return;
__send_package_info(socket, data); __send_package_info(socket, data);
data = null;
}); });
...@@ -167,7 +171,9 @@ function Client(socket) { ...@@ -167,7 +171,9 @@ function Client(socket) {
for (var key in socket_watchers) { for (var key in socket_watchers) {
try { try {
socket_watchers[key].close(); socket_watchers[key].close();
} catch (error_watch) {} } catch (error_watch) {
utils.errors_handler('client:disconnect', error_watch);
}
} }
}); });
}; };
......
...@@ -725,12 +725,14 @@ function Page_Distrubion(socket) { ...@@ -725,12 +725,14 @@ function Page_Distrubion(socket) {
socket.on(_e.distribution_packages, function (socket_data) { socket.on(_e.distribution_packages, function (socket_data) {
debug_socket('received', _e.distribution_packages, socket_data); debug_socket('received', _e.distribution_packages, socket_data);
packages.set(socket_data); packages.set(socket_data);
socket_data = null;
}); });
socket.on(_e.distribution_packages_status, function (socket_data) { socket.on(_e.distribution_packages_status, function (socket_data) {
debug_socket('received', _e.distribution_packages_status, socket_data); debug_socket('received', _e.distribution_packages_status, socket_data);
packages.set_status(socket_data); packages.set_status(socket_data);
sticky.set_status(socket_data); sticky.set_status(socket_data);
socket_data = null;
}); });
socket.on(config.events.broadcast.status_update, function (socket_data) { socket.on(config.events.broadcast.status_update, function (socket_data) {
...@@ -739,26 +741,31 @@ function Page_Distrubion(socket) { ...@@ -739,26 +741,31 @@ function Page_Distrubion(socket) {
if (socket_data.distribution == view.distribution.name && socket_data.package == view.package.orig_name) { if (socket_data.distribution == view.distribution.name && socket_data.package == view.package.orig_name) {
package_info.get(); package_info.get();
} }
socket_data = null;
}); });
socket.on(_e.package_files_list, function (socket_data) { socket.on(_e.package_files_list, function (socket_data) {
debug_socket('received', _e.package_files_list, socket_data); debug_socket('received', _e.package_files_list, socket_data);
files.set(socket_data); files.set(socket_data);
socket_data = null;
}); });
socket.on(_e.file, function (socket_data) { socket.on(_e.file, function (socket_data) {
debug_socket('received', _e.file, socket_data); debug_socket('received', _e.file, socket_data);
file.set(socket_data); file.set(socket_data);
socket_data = null;
}); });
socket.on(_e.file_newcontent, function (socket_data) { socket.on(_e.file_newcontent, function (socket_data) {
debug_socket('received', _e.file_newcontent, socket_data); debug_socket('received', _e.file_newcontent, socket_data);
new_lines.push(socket_data.file.new_content); new_lines.push(socket_data.file.new_content);
socket_data = null;
}); });
socket.on(_e.package_info, function (socket_data) { socket.on(_e.package_info, function (socket_data) {
debug_socket('received', _e.package_info, socket_data); debug_socket('received', _e.package_info, socket_data);
package_info.set(socket_data); package_info.set(socket_data);
socket_data = null;
}); });
$(window).on('hashchange', function () { $(window).on('hashchange', function () {
...@@ -775,6 +782,8 @@ function Page_Distrubion(socket) { ...@@ -775,6 +782,8 @@ function Page_Distrubion(socket) {
update.page(old_view); update.page(old_view);
page.go.up(); page.go.up();
debug(1, 'changing view', 'old:', old_view, 'new:', view); debug(1, 'changing view', 'old:', old_view, 'new:', view);
old_view = null;
new_view = null;
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment