Skip to content

Commit

Permalink
sbus: make sbus_connect_private_send static
Browse files Browse the repository at this point in the history
Asynchronous connection to D-Bus is only needed when creating a server
and that is done by `sbus_server_create_and_connect_send`. Non-blocking
connection does not make sense on other places in SSSD because we use
D-Bus for IPC therefore if D-Bus connection is not functional, our
process can not function as well and therefore the blocking connection
actually makes more sense.
  • Loading branch information
pbrezina committed Oct 30, 2023
1 parent d54eed8 commit e6a5458
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 49 deletions.
9 changes: 5 additions & 4 deletions src/sbus/connection/sbus_connection_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct sbus_connect_private_state {

static void sbus_connect_private_done(struct tevent_req *subreq);

struct tevent_req *
static struct tevent_req *
sbus_connect_private_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
const char *address,
Expand Down Expand Up @@ -318,9 +318,10 @@ static void sbus_connect_private_done(struct tevent_req *subreq)
return;
}

errno_t sbus_connect_private_recv(TALLOC_CTX *mem_ctx,
struct tevent_req *req,
struct sbus_connection **_conn)
static errno_t
sbus_connect_private_recv(TALLOC_CTX *mem_ctx,
struct tevent_req *req,
struct sbus_connection **_conn)
{
struct sbus_connect_private_state *state;
state = tevent_req_data(req, struct sbus_connect_private_state);
Expand Down
45 changes: 0 additions & 45 deletions src/sbus/sbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,51 +84,6 @@ sbus_connect_private(TALLOC_CTX *mem_ctx,
const char *dbus_name,
time_t *last_activity_time);

/**
* Connect to a private D-Bus bus at @address an perform its initialization
* asynchronously. Usually, you can just call @sbus_connect_private which
* will block for a while during Hello and RequestName calls, which is mostly
* ok since it is done during process initialization. However, you have to
* use asynchronous call if you are connecting to a server which runs on the
* same process, otherwise it will end up in dead lock.
*
* If @last_activity_time pointer is given, it is updated with current time
* each time an important event (such as method or property call) on the bus
* occurs. It is not updated when an signal arrives.
*
* @param mem_ctx Memory context.
* @param ev Tevent context.
* @param address Remote end-point address.
* @param dbus_name Name of this end-point.
* @param last_activity_time Pointer to a time that is updated each time
* an event occurs.
*
* @return Tevent request or NULL on error.
*
* @see sbus_server_create
*/
struct tevent_req *
sbus_connect_private_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
const char *address,
const char *dbus_name,
time_t *last_activity_time);

/**
* Recieve reply from @sbus_connect_private_send.
*
* @param mem_ctx Memory context.
* @param req Tevent request.
* @param _conn Established sbus connection.
*
* @return EOK on success, other errno code on failure.
*
* @see sbus_server_create
*/
errno_t sbus_connect_private_recv(TALLOC_CTX *mem_ctx,
struct tevent_req *req,
struct sbus_connection **_conn);

/**
* Create a new sbus server at socket address @address.
*
Expand Down

0 comments on commit e6a5458

Please sign in to comment.