I swear, this stream is gonna cause anger management issues

This commit is contained in:
eta 2020-04-05 19:11:02 +01:00
parent 2604bbe2cb
commit 3985aba03f
2 changed files with 21 additions and 12 deletions

View file

@ -173,16 +173,22 @@
;; and specify the speed manually, and then it works. ;; and specify the speed manually, and then it works.
;; ;;
;; Wouldn't it be nice if people documented this sort of thing? ;; Wouldn't it be nice if people documented this sort of thing?
;;
;; ### Part II: The Fucking Stream Strikes Back ###
;; ...and, after another hour of debugging, I found out you have to specify the `name'
;; arg, otherwise it breaks -- but ONLY randomly and once you decide to deploy it
;; in production, of course.
(let ((source (make-xmpp-source comp)) (let ((source (make-xmpp-source comp))
(fucking-stream (cxml:make-xstream (component-socket comp) (fucking-stream (cxml:make-xstream (component-socket comp)
:speed 1 ; FFFFFFFFUUUUUUUU :speed 1 ; FFFFFFFFUUUUUUUU
:name (cxml::make-stream-name ; AAAARGH
:entity-name "main document"
:entity-kind :main
:uri nil)
:name "XMPP server stream"
:initial-speed 1))) :initial-speed 1)))
(handler-case
(cxml:parse fucking-stream source (cxml:parse fucking-stream source
:recode t) :recode t)))
(error (e)
(format *debug-io* "~&Component listen thread failed: ~A~%" e)
(emit :error comp e)))))
(defmacro with-component-xml-output ((comp) &body body) (defmacro with-component-xml-output ((comp) &body body)
(let ((ret-sym (gensym))) (let ((ret-sym (gensym)))
@ -1478,6 +1484,12 @@ WhatsXMPP represents users as u440123456789 and groups as g1234-5678."
(on :connected ret (lambda () (wa-resetup-users ret))) (on :connected ret (lambda () (wa-resetup-users ret)))
ret)))) ret))))
#+sbcl
(defun report-error-and-die (err)
(format t "ERROR: ~A~%Backtrace: ~A~%" err
(trivial-backtrace:print-backtrace err))
(sb-ext:exit :code 1 :abort t))
#+sbcl #+sbcl
(defun main () (defun main ()
"Hacky main() function for running this in 'the real world' (outside emacs)" "Hacky main() function for running this in 'the real world' (outside emacs)"
@ -1486,14 +1498,11 @@ WhatsXMPP represents users as u440123456789 and groups as g1234-5678."
(setf swank:*configure-emacs-indentation* nil) (setf swank:*configure-emacs-indentation* nil)
(swank:create-server :dont-close t) (swank:create-server :dont-close t)
(setf *debugger-hook* (lambda (condition hook) (setf *debugger-hook* (lambda (condition hook)
(declare (ignore hook)) (report-error-and-die condition)))
(format t "ERROR: ~A~%" condition)
(sb-ext:exit :code 1 :abort t)))
(format t "*mario voice* Here we go!~%") (format t "*mario voice* Here we go!~%")
(defparameter *comp* (whatsxmpp-init)) (defparameter *comp* (whatsxmpp-init))
(on :error *comp* (lambda (e) (on :error *comp* (lambda (e)
(format t "ERROR: ~A~%" e) (report-error-and-die e)))
(sb-ext:exit :code 1 :abort t)))
;; don't pretty-print stuff with newlines ;; don't pretty-print stuff with newlines
(setf *print-right-margin* most-positive-fixnum) (setf *print-right-margin* most-positive-fixnum)
;; We don't have anything better to do, so let's wait on a condition ;; We don't have anything better to do, so let's wait on a condition

View file

@ -1,5 +1,5 @@
(defsystem "whatsxmpp" (defsystem "whatsxmpp"
:depends-on ("usocket" "bordeaux-threads" "event-emitter" "blackbird" "cxml" "ironclad" "uuid" "sqlite" "whatscl" "drakma" "local-time" "trivial-timers" "swank") :depends-on ("usocket" "bordeaux-threads" "event-emitter" "blackbird" "cxml" "ironclad" "uuid" "sqlite" "whatscl" "drakma" "local-time" "trivial-timers" "swank" "trivial-backtrace")
:serial t :serial t
:build-operation "program-op" :build-operation "program-op"
:build-pathname "whatsxmpp" :build-pathname "whatsxmpp"