[SignalingServer] Remove computing offloading 10/258210/1
authorInsoon Kim <is46.kim@samsung.com>
Wed, 12 May 2021 07:59:12 +0000 (00:59 -0700)
committerInsoon Kim <is46.kim@samsung.com>
Wed, 12 May 2021 07:59:12 +0000 (00:59 -0700)
This removes the unused computing offloading feature in
the signaling server.

Change-Id: I39be0281c524f2bd5bcb24d425125b06bb2ead39
Signed-off-by: Insoon Kim <is46.kim@samsung.com>
device_home/signaling_server/gen/app.js

index b29246cf4c45d2dd1b54f5fdc0f56971800d1937..ef2a0d9b5f0e38472a16097e68e2ec70ae1b5a91 100644 (file)
@@ -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 = {};