From 559d656fa91b1e6b140ff415b473828ff960d9a8 Mon Sep 17 00:00:00 2001 From: Insoon Kim Date: Wed, 12 May 2021 00:59:12 -0700 Subject: [PATCH] [SignalingServer] Remove computing offloading This removes the unused computing offloading feature in the signaling server. Change-Id: I39be0281c524f2bd5bcb24d425125b06bb2ead39 Signed-off-by: Insoon Kim --- device_home/signaling_server/gen/app.js | 57 ------------------------- 1 file changed, 57 deletions(-) diff --git a/device_home/signaling_server/gen/app.js b/device_home/signaling_server/gen/app.js index b29246cf..ef2a0d9b 100644 --- a/device_home/signaling_server/gen/app.js +++ b/device_home/signaling_server/gen/app.js @@ -260,63 +260,6 @@ httpServer.listen(httpPort, function () { console.log(TAG, `server is listening on http ${httpPort} port.`); }); -const headers = { - // Set CORS - 'Access-Control-Allow-Origin': '*', - 'Access-Control-Allow-Methods': 'OPTIONS, POST, GET', - 'Content-Type': 'application/json' - /* add other headers as per requirement */ -}; - -app.post('/api/js-offloading', function (request, response) { - console.log(TAG, `Post msg : /api/js-offloading`); - - let body = []; - request - .on('data', chunk => { - body.push(chunk); - }) - .on('end', () => { - body = Buffer.concat(body).toString(); - const jsonBody = JSON.parse(body); - - const offloadSocket = sockets.get(jsonBody.workerSocket); - console.log(' offload socket ' + offloadSocket); - if (offloadSocket !== undefined) { - console.log(TAG, `start offloading : `); - offloadSocket.emit( - 'message', - { - message: { - data: body, - type: 'COMPUTE' - } - }, - function (data) { - console.log(TAG, `result obtained from offload worker`); - const jsonRet = data; - if (jsonRet.errorCode === 'ERR_SCRIPT_EXECUTION_TIMEOUT') { - response.writeHead(408, headers); - response.end(JSON.stringify(jsonRet)); - } else if (jsonRet.errorCoode === 'UNKNOWN ERROR') { - response.writeHead(400, headers); - response.end(JSON.stringify(jsonRet)); - } else { - response.writeHead(200, headers); - response.end(JSON.stringify(jsonRet)); - console.log(TAG, jsonRet); - } - console.log(TAG, `responded to client`); - } - ); - } else { - console.log(TAG, `no registered compute worker`); - response.writeHead(404, headers); - response.end(); - } - }); -}); - function getMyAddress() { const interfaces = os.networkInterfaces(); const addresses = {}; -- 2.34.1