Make client report connection issues to servers

This commit is contained in:
harlekin
2022-08-30 18:11:17 +00:00
committed by Sheepit Renderfarm
parent 36b506aa6f
commit 3d5d91a1e4
3 changed files with 13 additions and 1 deletions

View File

@@ -1091,6 +1091,10 @@ import okhttp3.HttpUrl;
confirmJobReturnCode = Type.IMAGE_TOO_LARGE;
break retryLoop;
case SERVER_CONNECTION_FAILED:
confirmJobReturnCode = Type.NETWORK_ISSUE;
break;
case ERROR_BAD_RESPONSE:
// set the error and retry on next loop
confirmJobReturnCode = Type.ERROR_BAD_UPLOAD_RESPONSE;

View File

@@ -108,6 +108,7 @@ public class Error {
ERROR_NO_ROOT(2),
ERROR_BAD_RESPONSE(3),
ERROR_REQUEST_FAILED(5),
SERVER_CONNECTION_FAILED(6),
;
private final int id;

View File

@@ -650,6 +650,13 @@ public class Server extends Thread {
return ServerCode.UNKNOWN;
}
catch (ConnectException e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
this.log.error(checkpoint, String.format("Server::HTTPSendFile Error in upload process. Exception %s stacktrace ", e.getMessage()) + sw.toString());
return ServerCode.SERVER_CONNECTION_FAILED;
}
catch (IOException e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);