From: Timo Sirainen Date: Wed, 26 Jan 2022 18:19:53 +0000 (+0100) Subject: indexer: worker-connection - Remove unnecessarily public functions X-Git-Tag: 2.4.0~4433 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=996485b1e4e45899be45c853b39e43894b5059f7;p=thirdparty%2Fdovecot%2Fcore.git indexer: worker-connection - Remove unnecessarily public functions --- diff --git a/src/indexer/worker-connection.c b/src/indexer/worker-connection.c index 1250148300..924cf10851 100644 --- a/src/indexer/worker-connection.c +++ b/src/indexer/worker-connection.c @@ -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; diff --git a/src/indexer/worker-connection.h b/src/indexer/worker-connection.h index 2fb1575bf8..97fab78ed7 100644 --- a/src/indexer/worker-connection.h +++ b/src/indexer/worker-connection.h @@ -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);