changeset 708:d9a4e2f11b07

mod_auth_dovecot: If the connection fails, nuke it so the next attempt causes a reconnect.
author Kim Alvefur <zash@zash.se>
date Sat, 09 Jun 2012 01:47:31 +0200
parents f987c7b79008
children 151743149f07
files mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua	Fri Jun 08 21:02:41 2012 +0200
+++ b/mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua	Sat Jun 09 01:47:31 2012 +0200
@@ -135,6 +135,9 @@
 	local ok, err = self.conn:send(msg);
 	if not ok then
 		log("error", "Could not write to socket: %s", err);
+		if err == "closed" then
+			conn = nil;
+		end
 		return nil, err;
 	end
 	return true;
@@ -145,6 +148,9 @@
 	local line, err = self.conn:receive();
 	if not line then
 		log("error", "Could not read from socket: %s", err);
+		if err == "closed" then
+			conn = nil;
+		end
 		return nil, err;
 	end
 	module:log("debug", "received %q", line);