From: Timo Sirainen Date: Fri, 19 Feb 2010 03:10:06 +0000 (+0200) Subject: lib-auth: Added auth_client_disconnect(). X-Git-Tag: 2.0.beta3~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=63b70dd3e4b4d68a02b1bf7d78e92076210e3e1a;p=thirdparty%2Fdovecot%2Fcore.git lib-auth: Added auth_client_disconnect(). --HG-- branch : HEAD --- diff --git a/src/lib-auth/auth-client.c b/src/lib-auth/auth-client.c index c307ca34b2..3185187edd 100644 --- a/src/lib-auth/auth-client.c +++ b/src/lib-auth/auth-client.c @@ -31,6 +31,11 @@ void auth_client_deinit(struct auth_client **_client) i_free(client); } +void auth_client_disconnect(struct auth_client *client) +{ + auth_server_connection_disconnect(client->conn); +} + bool auth_client_is_connected(struct auth_client *client) { return client->conn->handshake_received; diff --git a/src/lib-auth/auth-client.h b/src/lib-auth/auth-client.h index 73694a420c..78566170b4 100644 --- a/src/lib-auth/auth-client.h +++ b/src/lib-auth/auth-client.h @@ -54,6 +54,7 @@ auth_client_init(const char *auth_socket_path, unsigned int client_pid, bool debug); void auth_client_deinit(struct auth_client **client); +void auth_client_disconnect(struct auth_client *client); bool auth_client_is_connected(struct auth_client *client); void auth_client_set_connect_notify(struct auth_client *client, auth_connect_notify_callback_t *callback, diff --git a/src/lib-auth/auth-server-connection.c b/src/lib-auth/auth-server-connection.c index 128a56391a..6b6ec57776 100644 --- a/src/lib-auth/auth-server-connection.c +++ b/src/lib-auth/auth-server-connection.c @@ -20,7 +20,7 @@ #define AUTH_SERVER_RECONNECT_TIMEOUT_SECS 5 static void -auth_server_connection_disconnect(struct auth_server_connection *conn); +auth_server_connection_reconnect(struct auth_server_connection *conn); static int auth_server_input_mech(struct auth_server_connection *conn, @@ -238,7 +238,7 @@ static void auth_server_connection_input(struct auth_server_connection *conn) return; case -1: /* disconnected */ - auth_server_connection_disconnect(conn); + auth_server_connection_reconnect(conn); return; case -2: /* buffer full - can't happen unless auth is buggy */ @@ -316,7 +316,7 @@ auth_server_connection_remove_requests(struct auth_server_connection *conn) hash_table_clear(conn->requests, FALSE); } -static void auth_server_connection_close(struct auth_server_connection *conn) +void auth_server_connection_disconnect(struct auth_server_connection *conn) { conn->handshake_received = FALSE; conn->version_received = FALSE; @@ -354,11 +354,11 @@ static void auth_server_reconnect_timeout(struct auth_server_connection *conn) } static void -auth_server_connection_disconnect(struct auth_server_connection *conn) +auth_server_connection_reconnect(struct auth_server_connection *conn) { time_t next_connect; - auth_server_connection_close(conn); + auth_server_connection_disconnect(conn); next_connect = conn->last_connect + AUTH_SERVER_RECONNECT_TIMEOUT_SECS; conn->to = timeout_add(ioloop_time >= next_connect ? 0 : @@ -372,8 +372,7 @@ void auth_server_connection_deinit(struct auth_server_connection **_conn) *_conn = NULL; - auth_server_connection_close(conn); - + auth_server_connection_disconnect(conn); hash_table_destroy(&conn->requests); array_free(&conn->available_auth_mechs); pool_unref(&conn->pool); @@ -384,7 +383,7 @@ static void auth_client_handshake_timeout(struct auth_server_connection *conn) i_error("Timeout waiting for handshake from auth server. " "my pid=%u, input bytes=%"PRIuUOFF_T, conn->client->client_pid, conn->input->v_offset); - auth_server_connection_disconnect(conn); + auth_server_connection_reconnect(conn); } int auth_server_connection_connect(struct auth_server_connection *conn) diff --git a/src/lib-auth/auth-server-connection.h b/src/lib-auth/auth-server-connection.h index b7e7b6c798..5627c6b1d6 100644 --- a/src/lib-auth/auth-server-connection.h +++ b/src/lib-auth/auth-server-connection.h @@ -31,6 +31,7 @@ auth_server_connection_init(struct auth_client *client); void auth_server_connection_deinit(struct auth_server_connection **conn); int auth_server_connection_connect(struct auth_server_connection *conn); +void auth_server_connection_disconnect(struct auth_server_connection *conn); unsigned int auth_server_connection_add_request(struct auth_server_connection *conn,