Changeset

135:8adf5fb27ce3

verse: Fire disconnected event even if connection fails instantly
author Matthew Wild <mwild1@gmail.com>
date Tue, 14 Sep 2010 15:02:29 +0100
parents 134:2101acbb27c4
children 136:3a85c62f544c
files init.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/init.lua	Mon Sep 13 15:44:22 2010 +0100
+++ b/init.lua	Tue Sep 14 15:02:29 2010 +0100
@@ -67,13 +67,13 @@
 	
 	if not success and err ~= "timeout" then
 		self:warn("connect() to %s:%d failed: %s", connect_host, connect_port, err);
-		return false, err;
+		return self:event("disconnected", { reason = err }) or false, err;
 	end
 
 	local conn = server.wrapclient(conn, connect_host, connect_port, new_listener(self), "*a");
 	if not conn then
 		self:warn("connection initialisation failed: %s", err);
-		return false, err;
+		return self:event("disconnected", { reason = err }) or false, err;
 	end
 	
 	self.conn = conn;