1
0
Fork 0

- [GUI] updated comment about the race condition;

- [GUI] try to open a non gemini file even if the mininum buffer size has not be reached, but the file has been downloaded entirely.
This commit is contained in:
cage 2024-09-26 20:36:41 +02:00
parent ae6c5a2986
commit a8621b91d5
1 changed files with 16 additions and 11 deletions

View File

@ -1171,12 +1171,12 @@ local file paths."
((or (gemini-parser:gemini-iri-p actual-iri)
needs-proxy)
(let ((stream-frame (stream-frame main-window)))
;; note: keeps this call before 'start-stream-iri', the
;; note: keeps this call before 'start-stream-iri'; the
;; latter will recursively call 'open-iri' (this
;; function) if a redirect is met, and the procedures to
;; delete and repopulate stream frames gets interleaved
;; in nodgui, I have to investigate
;; why.
;; in nodgui because of the same procedure called in
;; 'slurp-gemini-stream', but in a different thread.
(client-stream-frame::refresh-all-streams
(client-stream-frame::table stream-frame))
(start-stream-iri (iri-ensure-path actual-iri)
@ -1241,23 +1241,26 @@ local file paths."
(defun slurp-non-text-data (main-window iri &key (try-to-open t))
(declare (optimize (debug 0) (speed 3)))
(labels ((wait-until-download-complete (stream-info support-file)
(labels ((stream-completed-p (stream-info)
(string-equal (getf stream-info :stream-status)
:completed))
(wait-until-download-complete (stream-info support-file)
(declare (optimize (debug 0) (speed 3)))
(if (string-equal (getf stream-info :stream-status)
:completed)
(if (stream-completed-p stream-info)
(if try-to-open
(client-os-utils:open-resource-with-external-program main-window support-file)
(values (getf stream-info :support-file)
(getf stream-info :meta)))
(wait-enough-data)))
(buffer-filled-enough-to-open-p (buffer-size read-so-far)
(buffer-filled-enough-to-open-p (buffer-size read-so-far stream-info)
(declare (optimize (debug 0) (speed 3)))
(declare (fixnum buffer-size read-so-far))
(let ((filled-configuration-threshold (and buffer-size
(> read-so-far buffer-size))))
(or filled-configuration-threshold
(> read-so-far
swconf:+buffer-minimum-size-to-open+))))
swconf:+buffer-minimum-size-to-open+)
(stream-completed-p stream-info))))
(wait-enough-data ()
(declare (optimize (debug 0) (speed 3)))
(let* ((stream-info
@ -1275,7 +1278,9 @@ local file paths."
(not try-to-open))
(wait-until-download-complete stream-info support-file)
(let ((buffer-size (swconf:link-regex->program-to-use-buffer-size support-file)))
(if (buffer-filled-enough-to-open-p buffer-size read-so-far)
(if (buffer-filled-enough-to-open-p buffer-size
read-so-far
stream-info)
(client-os-utils:open-resource-with-external-program main-window
support-file)
(wait-enough-data))))