From b061955eb9b7869e2e94f911a9814a2333dab000 Mon Sep 17 00:00:00 2001 From: Sheepit Renderfarm Date: Fri, 29 Jul 2022 17:13:29 +0000 Subject: [PATCH] Feat: handle disable of session on denoising --- src/main/java/com/sheepit/client/Client.java | 12 ++++++++ src/main/java/com/sheepit/client/Error.java | 3 +- src/main/java/com/sheepit/client/Server.java | 3 ++ ...nSessionDisabledDenoisingNotSupported.java | 30 +++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/sheepit/client/exception/FermeExceptionSessionDisabledDenoisingNotSupported.java diff --git a/src/main/java/com/sheepit/client/Client.java b/src/main/java/com/sheepit/client/Client.java index b31d587..4e02da6 100644 --- a/src/main/java/com/sheepit/client/Client.java +++ b/src/main/java/com/sheepit/client/Client.java @@ -57,6 +57,7 @@ import com.sheepit.client.exception.FermeExceptionNoWritePermission; import com.sheepit.client.exception.FermeExceptionServerInMaintenance; import com.sheepit.client.exception.FermeExceptionServerOverloaded; import com.sheepit.client.exception.FermeExceptionSessionDisabled; +import com.sheepit.client.exception.FermeExceptionSessionDisabledDenoisingNotSupported; import com.sheepit.client.exception.FermeServerDown; import com.sheepit.client.hardware.cpu.CPU; import com.sheepit.client.os.OS; @@ -232,6 +233,17 @@ import okhttp3.HttpUrl; } } } + catch (FermeExceptionSessionDisabledDenoisingNotSupported e) { + this.gui.error(Error.humanString(Error.Type.DENOISING_NOT_SUPPORTED)); + // should wait forever to actually display the message to the user + while (shuttingdown == false) { + try { + Thread.sleep(1000); + } + catch (InterruptedException e1) { + } + } + } catch (FermeExceptionNoRendererAvailable e) { this.gui.error(Error.humanString(Error.Type.RENDERER_NOT_AVAILABLE)); // should wait forever to actually display the message to the user diff --git a/src/main/java/com/sheepit/client/Error.java b/src/main/java/com/sheepit/client/Error.java index 44cf2d2..9fec51a 100644 --- a/src/main/java/com/sheepit/client/Error.java +++ b/src/main/java/com/sheepit/client/Error.java @@ -89,6 +89,7 @@ public class Error { JOB_REQUEST_ERROR_NO_RENDERING_RIGHT(201), JOB_REQUEST_ERROR_DEAD_SESSION(202), JOB_REQUEST_ERROR_SESSION_DISABLED(203), + JOB_REQUEST_ERROR_SESSION_DISABLED_DENOISING_NOT_SUPPORTED(208), JOB_REQUEST_ERROR_INTERNAL_ERROR(204), JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE(205), JOB_REQUEST_SERVER_IN_MAINTENANCE(206), @@ -207,7 +208,7 @@ public class Error { case CPU_NOT_SUPPORTED: return "This CPU is not supported."; case DENOISING_NOT_SUPPORTED: - return "Denoising is not supported on this device."; + return "Denoising is not supported on this device. Session can not continue. Please use CPU or Virtual Machine with SSE4.1 instruction set."; case ENGINE_NOT_AVAILABLE: return "The project requires a rendering engine that isn't supported on this machine. Will try another project in a few minutes."; case NO_SPACE_LEFT_ON_DEVICE: diff --git a/src/main/java/com/sheepit/client/Server.java b/src/main/java/com/sheepit/client/Server.java index d2424cd..d2f6586 100644 --- a/src/main/java/com/sheepit/client/Server.java +++ b/src/main/java/com/sheepit/client/Server.java @@ -41,6 +41,7 @@ import java.util.stream.Collectors; import com.sheepit.client.datamodel.SpeedTestTarget; import com.sheepit.client.datamodel.SpeedTestResult; import com.sheepit.client.datamodel.SpeedTestTargetResult; +import com.sheepit.client.exception.FermeExceptionSessionDisabledDenoisingNotSupported; import com.sheepit.client.hardware.hwid.HWIdentifier; import com.sheepit.client.os.Windows; import lombok.Getter; @@ -379,6 +380,8 @@ public class Server extends Thread { throw new FermeExceptionNoSession(); case JOB_REQUEST_ERROR_SESSION_DISABLED: throw new FermeExceptionSessionDisabled(); + case JOB_REQUEST_ERROR_SESSION_DISABLED_DENOISING_NOT_SUPPORTED: + throw new FermeExceptionSessionDisabledDenoisingNotSupported(); case JOB_REQUEST_ERROR_INTERNAL_ERROR: throw new FermeExceptionBadResponseFromServer(); case JOB_REQUEST_ERROR_RENDERER_NOT_AVAILABLE: diff --git a/src/main/java/com/sheepit/client/exception/FermeExceptionSessionDisabledDenoisingNotSupported.java b/src/main/java/com/sheepit/client/exception/FermeExceptionSessionDisabledDenoisingNotSupported.java new file mode 100644 index 0000000..bae0456 --- /dev/null +++ b/src/main/java/com/sheepit/client/exception/FermeExceptionSessionDisabledDenoisingNotSupported.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2022 Laurent CLOUET + * Author Laurent CLOUET + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; version 2 + * of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package com.sheepit.client.exception; + +public class FermeExceptionSessionDisabledDenoisingNotSupported extends FermeException { + public FermeExceptionSessionDisabledDenoisingNotSupported() { + super(); + } + + public FermeExceptionSessionDisabledDenoisingNotSupported(String message_) { + super(message_); + } +}