This commit is contained in:
SongWei 2020-02-16 18:41:39 +11:00
parent 660df677e6
commit 620a8de744
3 changed files with 44 additions and 39 deletions

View File

@ -1,17 +1,8 @@
diag_log "leoext: try to initialize...";
leoext_stop = false;
_return = "libleoext" callExtension "foooo";
execVM "\leoservermod\marker.sqf";
leoext_stop = false;
[] spawn {
while {!leoext_stop} do {
sleep 1;
private _markers = call leoext_map_markers_information;
private _units = call leoext_units_pos;
"libleoext" callExtension ["foo", [[_markers, _units]]];
};
}
diag_log format ["leoext: initialize complete! return: %1", _return];

View File

@ -26,4 +26,17 @@ leoext_units_pos = {
} forEach allUnits;
_units_pos;
};
};
leoext_markers_start = {
[] spawn {
while {!leoext_stop} do {
sleep 1;
private _markers = call leoext_map_markers_information;
private _units = call leoext_units_pos;
"libleoext" callExtension ["foo", [[_markers, _units]]];
};
};
};
call leoext_markers_start;

View File

@ -86,33 +86,34 @@
(,(concatenate 'string "^" +static-prefix+ ".*$") ,#'serve-static-file)
(nil ,#'route-not-found)))
(if (not (find-package 'swank))
(sb-thread:make-thread
(lambda ()
(woo:run
(lambda (env)
;;(print env)
;;(print (type-of env))
(if (eq :post (getf env :request-method))
(let* ((post-stream (getf env :raw-body))
(char-stream (flexi-streams:make-flexi-stream
post-stream
:external-format :utf-8)))))
(sb-thread:make-thread
(lambda ()
(woo:run
(lambda (env)
;;(print env)
;;(print (type-of env))
(if (eq :post (getf env :request-method))
(let* ((post-stream (getf env :raw-body))
(char-stream (flexi-streams:make-flexi-stream
post-stream
:external-format :utf-8)))))
;(format t (read-line char-stream))))
;(format t "dispatching...")
(let ((route-function (dispatch (getf env :request-uri) +dispatch-table+)))
(format t "method:~A uri:~A route: ~A~%"
(getf env :request-method)
(getf env :request-uri)
route-function)
(funcall route-function env)))
:port 5000
:address "0.0.0.0"))
:name "webserver"))
(let ((route-function (dispatch (getf env :request-uri) +dispatch-table+)))
(format t "method:~A uri:~A route: ~A~%"
(getf env :request-method)
(getf env :request-uri)
route-function)
(funcall route-function env)))
:port 5000
:address "0.0.0.0"))
:name "webserver")
(sb-thread:list-all-threads)
(mapcar #'sb-thread:terminate-thread
(remove-if-not
(lambda (thread)
(string= "webserver" (sb-thread:thread-name thread)))
(sb-thread:list-all-threads)))
(if (find-package 'swank)
(mapcar #'sb-thread:terminate-thread
(remove-if-not
(lambda (thread)
(string= "webserver" (sb-thread:thread-name thread)))
(sb-thread:list-all-threads))))