Use genUuid rather than a simple counter for web requests
This commit is contained in:
parent
d256163d59
commit
6b0ba2997e
|
@ -16,7 +16,7 @@
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
import { Seal, Observe, Dataspace, Skeleton, currentFacet } from "@syndicate-lang/core";
|
import { genUuid, Seal, Observe, Dataspace, Skeleton, currentFacet } from "@syndicate-lang/core";
|
||||||
const { isCapture, captureName } = Skeleton;
|
const { isCapture, captureName } = Skeleton;
|
||||||
import { parse as parseUrl } from "url";
|
import { parse as parseUrl } from "url";
|
||||||
|
|
||||||
|
@ -53,8 +53,6 @@ spawn named 'HttpServerFactory' {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let nextId = 0;
|
|
||||||
|
|
||||||
function _server(host, port, httpsOptions) {
|
function _server(host, port, httpsOptions) {
|
||||||
const server = httpsOptions ? HttpsServer(host, port, httpsOptions) : HttpServer(host, port);
|
const server = httpsOptions ? HttpsServer(host, port, httpsOptions) : HttpServer(host, port);
|
||||||
|
|
||||||
|
@ -143,7 +141,7 @@ function _server(host, port, httpsOptions) {
|
||||||
}
|
}
|
||||||
react {
|
react {
|
||||||
const facet = currentFacet();
|
const facet = currentFacet();
|
||||||
let id = nextId++;
|
let id = genUuid('_httpRequest');
|
||||||
assert Request(id, server, method, pieces, url.query, Seal(req));
|
assert Request(id, server, method, pieces, url.query, Seal(req));
|
||||||
stop on retracted Observe(Request(_, server, method, pathPattern, _, _)) {
|
stop on retracted Observe(Request(_, server, method, pathPattern, _, _)) {
|
||||||
// Error resulting in teardown of the route
|
// Error resulting in teardown of the route
|
||||||
|
@ -193,7 +191,7 @@ function _server(host, port, httpsOptions) {
|
||||||
|
|
||||||
react {
|
react {
|
||||||
const facet = currentFacet();
|
const facet = currentFacet();
|
||||||
let id = nextId++;
|
let id = genUuid('_wsRequest');
|
||||||
assert WebSocket(id, server, pieces, url.query);
|
assert WebSocket(id, server, pieces, url.query);
|
||||||
|
|
||||||
on stop ws.close();
|
on stop ws.close();
|
||||||
|
|
Loading…
Reference in New Issue