1
0
Fork 0

Compare commits

..

5 Commits

Author SHA1 Message Date
cage 42f2aa5a1e - changed croatoan repository url. 2024-09-26 21:29:14 +02:00
cage a8621b91d5 - [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.
2024-09-26 20:36:41 +02:00
cage ae6c5a2986 - [GUI] added comment about race condition;
- [GUI] adde name to each thread spawned.
2024-09-26 17:02:49 +02:00
cage 8ac8ab2489 - [GUI] moved refreshing stream table before starting streaming, to prevent a race condition. 2024-09-26 14:23:18 +02:00
cage e8ff243e93 - changed croatoan repository url. 2024-09-26 13:06:40 +02:00
5 changed files with 31 additions and 17 deletions

View File

@ -165,7 +165,7 @@ Note that, at the moment, the ~quick_quicklisp.sh~ script will *not* install the
#+BEGIN_SRC sh #+BEGIN_SRC sh
$ cd $HOME/quicklisp/local-projects/ $ cd $HOME/quicklisp/local-projects/
$ git clone https://github.com/McParen/croatoan.git $ git clone https://codeberg.org/McParen/croatoan.git
#+END_SRC #+END_SRC
5. build the executable: 5. build the executable:

View File

@ -35,7 +35,7 @@ LISP_SOURCE_REGISTRY_FILE="$LISP_SOURCE_REGISTRY_DIR/source-registry.conf"
VERIFY_OK_RES=2 VERIFY_OK_RES=2
CROATOAN_GIT_URL=https://github.com/McParen/croatoan.git CROATOAN_GIT_URL=https://codeberg.org/McParen/croatoan.git
CROATOAN_DIR="$QUICKLISP_INSTALL_DIR"/local-projects/croatoan/ CROATOAN_DIR="$QUICKLISP_INSTALL_DIR"/local-projects/croatoan/

View File

@ -236,7 +236,8 @@
:aborting-function :aborting-function
#'aborting-function #'aborting-function
:ignore-certificate-expiration :ignore-certificate-expiration
ignore-certificate-expiration))))) ignore-certificate-expiration))
:name "stream thread")))
(setf (fetching-thread stream-wrapper) stream-thread) (setf (fetching-thread stream-wrapper) stream-thread)
stream-wrapper))))) stream-wrapper)))))
@ -1170,13 +1171,19 @@ local file paths."
((or (gemini-parser:gemini-iri-p actual-iri) ((or (gemini-parser:gemini-iri-p actual-iri)
needs-proxy) needs-proxy)
(let ((stream-frame (stream-frame main-window))) (let ((stream-frame (stream-frame main-window)))
;; 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 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) (start-stream-iri (iri-ensure-path actual-iri)
main-window main-window
use-cache use-cache
:ignore-certificate-expiration nil :ignore-certificate-expiration nil
:status status) :status status)))
(client-stream-frame::refresh-all-streams
(client-stream-frame::table stream-frame))))
((iri:absolute-url-p iri) ((iri:absolute-url-p iri)
(client-os-utils:open-resource-with-external-program main-window iri)) (client-os-utils:open-resource-with-external-program main-window iri))
((or (fs:file-exists-p actual-iri) ((or (fs:file-exists-p actual-iri)
@ -1234,23 +1241,26 @@ local file paths."
(defun slurp-non-text-data (main-window iri &key (try-to-open t)) (defun slurp-non-text-data (main-window iri &key (try-to-open t))
(declare (optimize (debug 0) (speed 3))) (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))) (declare (optimize (debug 0) (speed 3)))
(if (string-equal (getf stream-info :stream-status) (if (stream-completed-p stream-info)
:completed)
(if try-to-open (if try-to-open
(client-os-utils:open-resource-with-external-program main-window support-file) (client-os-utils:open-resource-with-external-program main-window support-file)
(values (getf stream-info :support-file) (values (getf stream-info :support-file)
(getf stream-info :meta))) (getf stream-info :meta)))
(wait-enough-data))) (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 (optimize (debug 0) (speed 3)))
(declare (fixnum buffer-size read-so-far)) (declare (fixnum buffer-size read-so-far))
(let ((filled-configuration-threshold (and buffer-size (let ((filled-configuration-threshold (and buffer-size
(> read-so-far buffer-size)))) (> read-so-far buffer-size))))
(or filled-configuration-threshold (or filled-configuration-threshold
(> read-so-far (> read-so-far
swconf:+buffer-minimum-size-to-open+)))) swconf:+buffer-minimum-size-to-open+)
(stream-completed-p stream-info))))
(wait-enough-data () (wait-enough-data ()
(declare (optimize (debug 0) (speed 3))) (declare (optimize (debug 0) (speed 3)))
(let* ((stream-info (let* ((stream-info
@ -1258,8 +1268,8 @@ local file paths."
1 1
ev:+maximum-event-priority+ ev:+maximum-event-priority+
iri)) iri))
(read-so-far (getf stream-info :octet-count -1)) (read-so-far (getf stream-info :octet-count -1))
(support-file (getf stream-info :support-file))) (support-file (getf stream-info :support-file)))
(multiple-value-bind (program-exists y wait-for-download) (multiple-value-bind (program-exists y wait-for-download)
(swconf:link-regex->program-to-use support-file) (swconf:link-regex->program-to-use support-file)
(declare (ignore y)) (declare (ignore y))
@ -1268,7 +1278,9 @@ local file paths."
(not try-to-open)) (not try-to-open))
(wait-until-download-complete stream-info support-file) (wait-until-download-complete stream-info support-file)
(let ((buffer-size (swconf:link-regex->program-to-use-buffer-size 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 (client-os-utils:open-resource-with-external-program main-window
support-file) support-file)
(wait-enough-data)))) (wait-enough-data))))
@ -2103,7 +2115,7 @@ local file paths."
:exclusive t)) :exclusive t))
(defun init-main-window (starting-iri) (defun init-main-window (starting-iri)
(setf gui:*debug-tk* t) (setf gui:*debug-tk* nil)
(gui:with-nodgui (:title +program-name+ :debugger-class 'gui:graphical-condition-handler) (gui:with-nodgui (:title +program-name+ :debugger-class 'gui:graphical-condition-handler)
(icons:load-icons) (icons:load-icons)
(setf gui-goodies:*toplevel* gui:*tk*) (setf gui-goodies:*toplevel* gui:*tk*)

View File

@ -25,7 +25,8 @@
(make-thread (lambda () (make-thread (lambda ()
(let ((gui:*wish* gui-goodies:*gui-server*)) (let ((gui:*wish* gui-goodies:*gui-server*))
(loop while (events-loop-running-p) do (loop while (events-loop-running-p) do
(ev:dispatch-program-events-or-wait))))))) (ev:dispatch-program-events-or-wait))))
:name "GUI events loop")))
(defmacro with-enqueue-request ((method-name id &rest args) &body on-error) (defmacro with-enqueue-request ((method-name id &rest args) &body on-error)
`(ev:with-enqueued-process-and-unblock () `(ev:with-enqueued-process-and-unblock ()

View File

@ -25,7 +25,8 @@
:text iri :text iri
:column-values :column-values
(list stream-status (list stream-status
(to-s (getf row :octet-count))) (to-s (getf row
:octet-count)))
:index gui:+treeview-last-index+))) :index gui:+treeview-last-index+)))
(gui:treeview-insert-item tree :item tree-row))) (gui:treeview-insert-item tree :item tree-row)))
(gui:treeview-refit-columns-width (gui-goodies:tree stream-table)) (gui:treeview-refit-columns-width (gui-goodies:tree stream-table))