From 359c8205efa203e2e7ca8b78afad7b56d9dc16d7 Mon Sep 17 00:00:00 2001 From: Andrey Sidorov Date: Tue, 19 Jul 2011 09:31:47 +1000 Subject: [PATCH] XClient.terminate --- lib/x11/xcore.js | 6 ++++++ test/listext.js | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/x11/xcore.js b/lib/x11/xcore.js index f0950ec..2f6c5a7 100644 --- a/lib/x11/xcore.js +++ b/lib/x11/xcore.js @@ -76,6 +76,12 @@ function XClient(stream) } util.inherits(XClient, EventEmitter); +// TODO: close() = set 'closing' flag, watch it in replies and writeQueue, terminate if empty +XClient.prototype.terminate = function() +{ + this.stream.end(); +} + XClient.prototype.importRequestsFromTemplates = function(target, reqs) { var client = this; diff --git a/test/listext.js b/test/listext.js index da516cb..0ec2fe6 100644 --- a/test/listext.js +++ b/test/listext.js @@ -2,7 +2,9 @@ var x11 = require('../lib/x11'); var X = x11.createClient(); X.on('connect', function(display) { X.ListExtensions(function(list) { - console.log(list); - X.close(); + list.forEach(function(ext) { + console.log(ext); + }); + X.terminate(); }); });