+ final Channel inheritedChannel;
+ try {
+ inheritedChannel = System.inheritedChannel();
+ if (inheritedChannel instanceof ServerSocketChannel serverChannel) {
+ logger.info("Using inherited socket: " + serverChannel.getLocalAddress());
+ runSocketSingleAccount(m, serverChannel, receiveMode == ReceiveMode.MANUAL);
+ }
+ } catch (IOException e) {
+ throw new IOErrorException("Failed to use inherited socket", e);
+ }
+ final var socketFile = ns.<File>get("socket");
+ if (socketFile != null) {
+ final var address = UnixDomainSocketAddress.of(socketFile.toPath());
+ final var serverChannel = IOUtils.bindSocket(address);
+ runSocketSingleAccount(m, serverChannel, receiveMode == ReceiveMode.MANUAL);
+ }
+ final var tcpAddress = ns.getString("tcp");
+ if (tcpAddress != null) {
+ final var address = IOUtils.parseInetSocketAddress(tcpAddress);
+ final var serverChannel = IOUtils.bindSocket(address);
+ runSocketSingleAccount(m, serverChannel, receiveMode == ReceiveMode.MANUAL);
+ }
+ final var isDbusSystem = Boolean.TRUE.equals(ns.getBoolean("dbus-system"));
+ if (isDbusSystem) {
+ runDbusSingleAccount(m, true, receiveMode != ReceiveMode.ON_START);
+ }
+ final var isDbusSession = Boolean.TRUE.equals(ns.getBoolean("dbus"));
+ if (isDbusSession || (
+ !isDbusSystem
+ && socketFile == null
+ && tcpAddress == null
+ && !(inheritedChannel instanceof ServerSocketChannel)
+ )) {
+ runDbusSingleAccount(m, false, receiveMode != ReceiveMode.ON_START);