Comparison

init.lua @ 132:b38397163737

verse: Log error and return when trying to close a closed connection
author Matthew Wild <mwild1@gmail.com>
date Mon, 13 Sep 2010 14:49:30 +0100
parent 126:fa3ddadb8364
child 135:8adf5fb27ce3
comparison
equal deleted inserted replaced
131:1c30dd51ca6b 132:b38397163737
81 self.send = function (_, data) return w(conn, t(data)); end 81 self.send = function (_, data) return w(conn, t(data)); end
82 return true; 82 return true;
83 end 83 end
84 84
85 function stream:close() 85 function stream:close()
86 if not self.conn then
87 verse.log("error", "Attempt to close disconnected connection - possibly a bug");
88 return;
89 end
86 local on_disconnect = self.conn.disconnect(); 90 local on_disconnect = self.conn.disconnect();
87 self.conn:close(); 91 self.conn:close();
88 on_disconnect(conn, reason); 92 on_disconnect(conn, reason);
89 end 93 end
90 94