Comparison

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
comparison
equal deleted inserted replaced
95:d67ad403ca55 96:f0aec10023aa
61 end 61 end
62 62
63 self.conn = conn; 63 self.conn = conn;
64 local w, t = conn.write, tostring; 64 local w, t = conn.write, tostring;
65 self.send = function (_, data) return w(conn, t(data)); end 65 self.send = function (_, data) return w(conn, t(data)); end
66 return true;
67 end
68
69 function stream:close()
70 local on_disconnect = self.conn.disconnect();
71 self.conn:close();
72 on_disconnect(conn, reason);
66 end 73 end
67 74
68 -- Logging functions 75 -- Logging functions
69 function stream:debug(...) 76 function stream:debug(...)
70 if self.logger and self.log.debug then 77 if self.logger and self.log.debug then