]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-auth: Added auth_client_disconnect().
authorTimo Sirainen <tss@iki.fi>
Fri, 19 Feb 2010 03:10:06 +0000 (05:10 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 19 Feb 2010 03:10:06 +0000 (05:10 +0200)
--HG--
branch : HEAD

src/lib-auth/auth-client.c
src/lib-auth/auth-client.h
src/lib-auth/auth-server-connection.c
src/lib-auth/auth-server-connection.h

index c307ca34b2d679328f0f49219767cc508777fb6f..3185187eddcd5d5eb5d64686b3a73dc82c3f3b21 100644 (file)
@@ -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;
index 73694a420c7608f0ec98f317d0b56b94c3f9fcd7..78566170b47f5d0e41642af83e42445d90991553 100644 (file)
@@ -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,
index 128a56391abee29ce3b8a7b57262ed2e5b32f6bd..6b6ec5777629409c5c4a3b85da76d1a6f5fef793 100644 (file)
@@ -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)
index b7e7b6c798bb5651b67dc9f85d2fa9b8b87ca001..5627c6b1d61ee1a3ec07531428996923cb5b4fce 100644 (file)
@@ -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,