public Mono<UserSession> handleLoginRequest(
            int version,
            @NotNull ByteArrayWrapper ip,
            @NotNull Long userId,
            @Nullable String password,
            @NotNull DeviceType deviceType,
            @Nullable Map<String, String> deviceDetails,
            @Nullable UserStatus userStatus,
            @Nullable Location location,
            @Nullable String ipStr) {
        if (version != 1) {
            return Mono.error(ResponseException.get(ResponseStatusCode.UNSUPPORTED_CLIENT_VERSION,
                    "Supported client versions are: [1], but got: "
                            + version));
        }
        if (userSimultaneousLoginService.isForbiddenDeviceType(deviceType)) {
            return Mono.error(
                    ResponseException.get(ResponseStatusCode.LOGIN_FROM_FORBIDDEN_DEVICE_TYPE));
        }
        return sessionAuthenticationManager
                .verifyAndGrant(version,
                        userId,
                        password,
                        deviceType,
                        deviceDetails,
                        userStatus,
                        location,
                        ipStr)
                .flatMap(permissionInfo -> {
                    ResponseStatusCode statusCode = permissionInfo.authenticationCode();
                    return statusCode == ResponseStatusCode.OK
                            ? tryRegisterOnlineUser(version,
                                    permissionInfo.permissions(),
                                    ip,
                                    userId,
                                    deviceType,
                                    deviceDetails,
                                    userStatus,
                                    location)
                            : Mono.error(ResponseException.get(statusCode));
                });
    }
We don't use "NonBlockingHashMapLong" because we need to support IPv6 addresses, which takes
16 bytes per address. So we can only eliminate unnecessary objects after Valhalla publish
value objects.
turms-gateway/src/main/java/im/turms/gateway/domain/session/service/SessionService.java