From 6b0ba2997e7d3380910a7e3c0f69c0beb6c63fa7 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 5 Nov 2018 21:16:57 +0000 Subject: [PATCH] Use genUuid rather than a simple counter for web requests --- packages/driver-http-node/src/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/driver-http-node/src/index.js b/packages/driver-http-node/src/index.js index 0adcd94..008b6ef 100644 --- a/packages/driver-http-node/src/index.js +++ b/packages/driver-http-node/src/index.js @@ -16,7 +16,7 @@ // along with this program. If not, see . //--------------------------------------------------------------------------- -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; import { parse as parseUrl } from "url"; @@ -53,8 +53,6 @@ spawn named 'HttpServerFactory' { } } -let nextId = 0; - function _server(host, port, httpsOptions) { const server = httpsOptions ? HttpsServer(host, port, httpsOptions) : HttpServer(host, port); @@ -143,7 +141,7 @@ function _server(host, port, httpsOptions) { } react { const facet = currentFacet(); - let id = nextId++; + let id = genUuid('_httpRequest'); assert Request(id, server, method, pieces, url.query, Seal(req)); stop on retracted Observe(Request(_, server, method, pathPattern, _, _)) { // Error resulting in teardown of the route @@ -193,7 +191,7 @@ function _server(host, port, httpsOptions) { react { const facet = currentFacet(); - let id = nextId++; + let id = genUuid('_wsRequest'); assert WebSocket(id, server, pieces, url.query); on stop ws.close();