static void new_connection_callback (DBusServer *server, DBusConnection *new_connection, void *data) { BusContext *context = data; if (!bus_connections_setup_connection (context->connections, new_connection)) { _dbus_verbose ("No memory to setup new connection\n"); /* if we don't do this, it will get unref'd without * being disconnected... kind of strange really * that we have to do this, people won't get it right * in general. */ dbus_connection_close (new_connection); } dbus_connection_set_max_received_size (new_connection, context->limits.max_incoming_bytes); dbus_connection_set_max_message_size (new_connection, context->limits.max_message_size); /* on OOM, we won't have ref'd the connection so it will die. */ }
static int ldbus_connection_set_max_message_size(lua_State *L) { DBusConnection *connection = check_DBusConnection(L, 1); long size = luaL_checklong(L, 2); dbus_connection_set_max_message_size(connection, size); return 0; }