Changeset

96:f0aec10023aa

verse: Return true from connect() on success, add stream:close()
author Matthew Wild <mwild1@gmail.com>
date Sat, 21 Aug 2010 14:36:21 +0100
parents 95:d67ad403ca55
children 97:ad6006779416
files init.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/init.lua	Sat Aug 21 14:35:51 2010 +0100
+++ b/init.lua	Sat Aug 21 14:36:21 2010 +0100
@@ -63,6 +63,13 @@
 	self.conn = conn;
 	local w, t = conn.write, tostring;
 	self.send = function (_, data) return w(conn, t(data)); end
+	return true;
+end
+
+function stream:close()
+	local on_disconnect = self.conn.disconnect();
+	self.conn:close();
+	on_disconnect(conn, reason);
 end
 
 -- Logging functions