From 10bb07b2d12f232a2ec68f3a1b8e337be9582f7d Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Wed, 27 May 2020 16:46:04 -0400 Subject: Added an additional failure condition. Exit dumb_renderer on error with initial site. --- protocol.f90 | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'protocol.f90') diff --git a/protocol.f90 b/protocol.f90 index b0699a6..4948325 100644 --- a/protocol.f90 +++ b/protocol.f90 @@ -31,6 +31,7 @@ implicit none integer, parameter::STATUS_CERTREQ = 6 integer, parameter::STATUS_BADRESPONSE = 7 integer, parameter::STATUS_LOCALFAIL = -1 + integer, parameter::STATUS_CONNECTFAIL = -2 integer, parameter::BUFFER_SIZE = 256 @@ -38,6 +39,17 @@ implicit none contains + function is_failure_code(return_code) + implicit none + + integer, intent(in)::return_code + logical::is_failure_code + + is_failure_code = any(return_code == & + [STATUS_CONNECTFAIL, STATUS_LOCALFAIL, STATUS_BADRESPONSE, STATUS_PERMFAIL, STATUS_TEMPFAIL]) + + end function is_failure_code + subroutine get_mimetype(status_line, return_type) implicit none @@ -225,16 +237,17 @@ contains else - returncode = -1 + returncode = STATUS_CONNECTFAIL write(unit_number, *) "Send Error: Could Not Send Request" end if else - returncode = -1 + returncode = STATUS_CONNECTFAIL write(unit_number, *) "Connection Error: "//trim(translate_connection_code(conn%code)) write(*, *) "Connection Error: "//trim(translate_connection_code(conn%code)) + end if call close_connection(conn) -- cgit v1.2.3