mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-09 03:48:02 +02:00
bus_context_add_incoming_connection: factor out
Reviewed-by: Philip Withnall <withnall@endlessm.com> [smcv: Fix minor conflict] Signed-off-by: Simon McVittie <smcv@collabora.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
This commit is contained in:
parent
a7babbf10f
commit
8359321ea1
2 changed files with 12 additions and 2 deletions
12
bus/bus.c
12
bus/bus.c
|
|
@ -176,8 +176,14 @@ new_connection_callback (DBusServer *server,
|
|||
DBusConnection *new_connection,
|
||||
void *data)
|
||||
{
|
||||
BusContext *context = data;
|
||||
/* If this fails it logs a warning, so we don't need to do that */
|
||||
bus_context_add_incoming_connection (data, new_connection);
|
||||
}
|
||||
|
||||
dbus_bool_t
|
||||
bus_context_add_incoming_connection (BusContext *context,
|
||||
DBusConnection *new_connection)
|
||||
{
|
||||
/* If this fails it logs a warning, so we don't need to do that */
|
||||
if (!bus_connections_setup_connection (context->connections, new_connection))
|
||||
{
|
||||
|
|
@ -187,6 +193,8 @@ new_connection_callback (DBusServer *server,
|
|||
* in general.
|
||||
*/
|
||||
dbus_connection_close (new_connection);
|
||||
/* on OOM, we won't have ref'd the connection so it will die. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
dbus_connection_set_max_received_size (new_connection,
|
||||
|
|
@ -204,7 +212,7 @@ new_connection_callback (DBusServer *server,
|
|||
dbus_connection_set_allow_anonymous (new_connection,
|
||||
context->allow_anonymous);
|
||||
|
||||
/* on OOM, we won't have ref'd the connection so it will die. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -150,6 +150,8 @@ void bus_context_check_all_watches (BusContext
|
|||
dbus_bool_t bus_context_setup_server (BusContext *context,
|
||||
DBusServer *server,
|
||||
DBusError *error);
|
||||
dbus_bool_t bus_context_add_incoming_connection (BusContext *context,
|
||||
DBusConnection *new_connection);
|
||||
|
||||
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
|
||||
void bus_context_quiet_log_begin (BusContext *context);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue