mirror of
https://codeberg.org/cage/tinmop/
synced 2025-01-03 01:09:20 +01:00
- [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:
parent
0e21344259
commit
fcf711b95d
@ -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
|
||||
@ -1265,8 +1268,8 @@ local file paths."
|
||||
1
|
||||
ev:+maximum-event-priority+
|
||||
iri))
|
||||
(read-so-far (getf stream-info :octet-count -1))
|
||||
(support-file (getf stream-info :support-file)))
|
||||
(read-so-far (getf stream-info :octet-count -1))
|
||||
(support-file (getf stream-info :support-file)))
|
||||
(multiple-value-bind (program-exists y wait-for-download)
|
||||
(swconf:link-regex->program-to-use support-file)
|
||||
(declare (ignore y))
|
||||
@ -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))))
|
||||
|
Loading…
Reference in New Issue
Block a user