Use genUuid rather than a simple counter for web requests

This commit is contained in:
Tony Garnock-Jones 2018-11-05 21:16:57 +00:00
parent d256163d59
commit 6b0ba2997e
1 changed files with 3 additions and 5 deletions

View File

@ -16,7 +16,7 @@
// 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;
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();