Diff

init.lua @ 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
parent 95:d67ad403ca55
child 98:1dccff7df2d5
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