From d54c9419af99cd9c63a8bb0021e1feb4fe0a2db0 Mon Sep 17 00:00:00 2001 From: edgarsilva Date: Tue, 4 Mar 2014 10:45:19 -0600 Subject: [PATCH] Add a stop function to the base connection class. --- lib/connection.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/connection.js b/lib/connection.js index 32f3236..02d9f5b 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -101,6 +101,19 @@ namespace("Cylon", function() { return this.robot.initAdaptor(opts.adaptor, this.self, opts); }; + // Public: Stop the adaptor's connection + // + // Returns nothing + Connection.prototype.stop = function() { + var msg; + msg = "Stopping adaptor '" + this.name + "'"; + if (this.port != null) { + msg += " on port '" + (this.port.toString()) + "'"; + } + Logger.info(msg); + return this.disconnect(); + }; + return Connection; })(EventEmitter);