diff options
author | Jeffrey Armstrong <jeff@approximatrix.com> | 2021-06-29 16:06:44 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeff@approximatrix.com> | 2021-06-29 16:06:44 -0400 |
commit | cd4a5891b8e2a019fdfda7512d6490e075628292 (patch) | |
tree | 8012dc7dc52f17632f5b429dea79709e55ab96c4 /player | |
parent | d282a7e283a1704cdde2649c7caf130fb923051a (diff) | |
download | levitating-cd4a5891b8e2a019fdfda7512d6490e075628292.tar.gz levitating-cd4a5891b8e2a019fdfda7512d6490e075628292.zip |
Tokens are now checked for file uploads. Fixed major buffer bugs in status reporting.
Diffstat (limited to 'player')
-rw-r--r-- | player/instructions.f90 | 6 | ||||
-rw-r--r-- | player/player.F90 | 8 | ||||
-rw-r--r-- | player/talking.f90 | 5 | ||||
-rw-r--r-- | player/tasks.f90 | 15 |
4 files changed, 28 insertions, 6 deletions
diff --git a/player/instructions.f90 b/player/instructions.f90 index 4669f18..65b392d 100644 --- a/player/instructions.f90 +++ b/player/instructions.f90 @@ -381,7 +381,10 @@ contains end if if(get_task_failure_okay(j, i) .and. .not. success) then + Print *, "Reseting to failure" success = .true. + else if(.not. success) then + Print *, "Task failure" end if end function perform_task @@ -411,6 +414,7 @@ contains do i = 1, task_count call get_status_url(job_id, i, url, status=STATUS_STARTING) + Print *, "Reporting: "//trim(url) server_status = request_to_ignored(url) res = perform_task(j, i, captured_filename) @@ -444,9 +448,11 @@ contains else call get_status_url(job_id, i, url, status=STATUS_FAILED) server_status = request_to_ignored(url) + Print *, "Attempted reporting failure" exit endif end if + end do call get_job_report_url(job_id, res, url) diff --git a/player/player.F90 b/player/player.F90 index 121b441..2233aff 100644 --- a/player/player.F90 +++ b/player/player.F90 @@ -71,6 +71,7 @@ implicit none call get_instruction_name_from_checkin(j_checkin, instruction_name) call get_instruction_url(instruction_name, url) + instr_json_available = request_json(url, j_instructions) if(instr_json_available) then @@ -117,7 +118,8 @@ contains Print *, " -h Display this help" Print *, " -w <dir> Use dir as the working directory" Print *, " -l <log> Use log as the logfile" - Print *, " -i <identity> This players identity" + Print *, " -i <identity> This player's identity" + Print *, " -t <token> This player's security token" end subroutine usage @@ -158,6 +160,10 @@ contains else if(trim(option) == "-i") then i = i + 1 call get_command_argument(i, identity) + + else if(trim(option) == "-t") then + i = i + 1 + call get_command_argument(i, token) end if diff --git a/player/talking.f90 b/player/talking.f90 index 42b6451..2171f41 100644 --- a/player/talking.f90 +++ b/player/talking.f90 @@ -94,6 +94,7 @@ contains open(newunit=io, status="scratch", access='stream') status_code = request_url(mod_url, io, return_type) + Print *, status_code close(io) deallocate(mod_url) @@ -102,7 +103,7 @@ contains function send_file(url, filename) result(status_code) use gemini_protocol - use config, only: token + use config, only: token, identity implicit none character(*), intent(in)::url @@ -125,7 +126,7 @@ contains access='STREAM', form='UNFORMATTED', iostat=istatus) if(istatus == 0) then - status_code = titan_post_url(mod_url, unit_number, file_size, token) + status_code = titan_post_url(mod_url, unit_number, file_size, trim(identity)//":"//trim(token)) close(unit_number) else status_code = STATUS_LOCALFAIL diff --git a/player/tasks.f90 b/player/tasks.f90 index e0eecfd..b0f2cc1 100644 --- a/player/tasks.f90 +++ b/player/tasks.f90 @@ -118,7 +118,7 @@ contains allocate(character(len=len_trim(mask)+DIR_LIST_STRING_LENGTH+1) :: fullname) call path_from_file(mask, dir) - allocate(statuses(size(files))) + allocate(statuses(size(files))) do i = 1, size(files) ! On some systems, we're getting subdirectories back... @@ -143,11 +143,15 @@ contains res = .false. end if + + if(.not. res) then + Print *, "Glob failure" + end if end function upload_glob function upload(url, source_filename) result(res) - use config, only: token, captain + use config, only: token, captain, identity use gemini_protocol, only: titan_post_url, STATUS_SUCCESS implicit none @@ -205,7 +209,8 @@ contains if(istatus == 0) then Print *, "Writing "//trim(mod_url) - istatus = titan_post_url(mod_url, unit_number, file_size, token) + istatus = titan_post_url(mod_url, unit_number, file_size, trim(identity)//":"//trim(token)) + Print *, "Response code from server: ", istatus res = (istatus == STATUS_SUCCESS) close(unit_number) else @@ -214,6 +219,10 @@ contains deallocate(mod_url) + if(.not. res) then + Print *, "Upload Failure" + end if + end function upload function download(url, destination_filename) |