]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
indexer: worker-connection - Remove unnecessarily public functions
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 26 Jan 2022 18:19:53 +0000 (19:19 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Sun, 13 Feb 2022 10:23:26 +0000 (10:23 +0000)
src/indexer/worker-connection.c
src/indexer/worker-connection.h

index 1250148300698578b7d437f0a552ecc21e69c642..924cf108515dd8df09dcadf3cfa4f1d51860dd1e 100644 (file)
@@ -45,7 +45,7 @@ static void worker_connection_call_callback(struct worker_connection *worker,
                worker->request = NULL;
 }
 
-void worker_connection_destroy(struct connection *conn)
+static void worker_connection_destroy(struct connection *conn)
 {
        struct worker_connection *worker =
                container_of(conn, struct worker_connection, conn);
@@ -117,23 +117,13 @@ worker_connection_input_args(struct connection *conn, const char *const *args)
        return ret;
 }
 
-bool worker_connection_is_connected(struct connection *conn)
-{
-       return !conn->disconnected;
-}
-
-unsigned int worker_connections_get_process_limit(void)
-{
-       return worker_last_process_limit;
-}
-
 void worker_connection_request(struct connection *conn,
                               struct indexer_request *request)
 {
        struct worker_connection *worker =
                container_of(conn, struct worker_connection, conn);
 
-       i_assert(worker_connection_is_connected(conn));
+       i_assert(!conn->disconnected);
 
        if (worker->request_username == NULL)
                worker->request_username = i_strdup(request->username);
@@ -167,13 +157,6 @@ void worker_connection_request(struct connection *conn,
        } T_END;
 }
 
-const char *worker_connection_get_username(struct connection *conn)
-{
-       struct worker_connection *worker =
-               container_of(conn, struct worker_connection, conn);
-       return worker->request_username;
-}
-
 static const struct connection_vfuncs worker_connection_vfuncs = {
        .destroy = worker_connection_destroy,
        .input_args = worker_connection_input_args,
@@ -210,7 +193,7 @@ int worker_connection_try_create(const char *socket_path,
        struct worker_connection *conn;
        unsigned int max_connections;
 
-       max_connections = I_MAX(1, worker_connections_get_process_limit());
+       max_connections = I_MAX(1, worker_last_process_limit);
        if (worker_connections->connections_count >= max_connections)
                return 0;
 
@@ -236,11 +219,13 @@ unsigned int worker_connections_get_count(void)
 struct connection *worker_connections_find_user(const char *username)
 {
        struct connection *conn;
-       const char *worker_user;
 
        for (conn = worker_connections->connections; conn != NULL; conn = conn->next) {
-               worker_user = worker_connection_get_username(conn);
-               if (worker_user != NULL && strcmp(worker_user, username) == 0)
+               struct worker_connection *worker =
+                       container_of(conn, struct worker_connection, conn);
+
+               if (worker->request_username != NULL &&
+                   strcmp(worker->request_username, username) == 0)
                        return conn;
        }
        return NULL;
index 2fb1575bf86d56f2cc6ca8a176781f909db3ff4a..97fab78ed736de4557216f17710f438355933dad 100644 (file)
@@ -15,23 +15,12 @@ int worker_connection_try_create(const char *socket_path,
                                 indexer_status_callback_t *callback,
                                 worker_available_callback_t *avail_callback,
                                 struct connection **conn_r);
-void worker_connection_destroy(struct connection *conn);
-
-/* Returns TRUE if worker is connected to (not necessarily handshaked yet) */
-bool worker_connection_is_connected(struct connection *conn);
-
-/* Returns the last process_limit returned by a worker connection handshake.
-   If no handshakes have been received yet, returns 0. */
-unsigned int worker_connections_get_process_limit(void);
 
 /* Send a new indexing request for username+mailbox. The status callback is
    called as necessary. Requests can be queued, but only for the same
    username. */
 void worker_connection_request(struct connection *conn,
                               struct indexer_request *request);
-/* Returns username of the currently pending requests,
-   or NULL if there are none. */
-const char *worker_connection_get_username(struct connection *conn);
 
 unsigned int worker_connections_get_count(void);
 struct connection *worker_connections_find_user(const char *username);