diff mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua @ 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 0c130c45b7c1
children c9e2beec4ef6
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);