Changeset

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
parents 131:1c30dd51ca6b
children 133:a0ed30b0e789
files init.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/init.lua	Mon Sep 13 14:48:10 2010 +0100
+++ b/init.lua	Mon Sep 13 14:49:30 2010 +0100
@@ -83,6 +83,10 @@
 end
 
 function stream:close()
+	if not self.conn then 
+		verse.log("error", "Attempt to close disconnected connection - possibly a bug");
+		return;
+	end
 	local on_disconnect = self.conn.disconnect();
 	self.conn:close();
 	on_disconnect(conn, reason);