Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metacom

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metacom - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

9

CHANGELOG.md

@@ -5,2 +5,8 @@ # Changelog

## [1.3.0][] - 2021-02-07
- Fix channel collection memory leak and duplication
- Change `Server` constrictor signature to `(config, application)`
- Fix spelling in method: Channel.startSession
## [1.2.0][] - 2021-02-04

@@ -31,3 +37,4 @@

[unreleased]: https://github.com/metarhia/metacom/compare/v1.2.0...HEAD
[unreleased]: https://github.com/metarhia/metacom/compare/v1.3.0...HEAD
[1.3.0]: https://github.com/metarhia/metacom/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/metarhia/metacom/compare/v1.1.0...v1.2.0

@@ -34,0 +41,0 @@ [1.1.0]: https://github.com/metarhia/metacom/compare/v1.0.0...v1.1.0

11

lib/channel.js

@@ -58,5 +58,4 @@ 'use strict';

class Client {
constructor(channel) {
constructor() {
this.callId = 0;
channels.set(this, channel);
}

@@ -105,3 +104,5 @@

this.application = application;
this.client = new Client(this);
const client = new Client();
this.client = client;
channels.set(client, this);
this.session = null;

@@ -238,3 +239,3 @@ this.restoreSession();

starSession() {
startSession() {
const token = this.generateToken();

@@ -268,2 +269,2 @@ const host = metautil.parseHost(this.req.headers.host);

module.exports = { Channel };
module.exports = { Channel, channels };

@@ -11,2 +11,3 @@ 'use strict';

const { Semaphore } = require('./semaphore.js');
const { Channel, channels } = require('./channel.js');

@@ -31,7 +32,5 @@ const SHUTDOWN_TIMEOUT = 5000;

class Server {
constructor(config, { application, Channel }) {
constructor(config, application) {
this.config = config;
this.application = application;
this.Channel = Channel;
this.channels = new Map();
const { host, balancer, protocol, ports, concurrency, queue } = config;

@@ -59,7 +58,6 @@ this.semaphore = new Semaphore(concurrency, queue.size, queue.timeout);

async listener(req, res) {
const { channels, Channel } = this;
let finished = false;
const { url, connection } = req;
const { url } = req;
const channel = await new Channel(req, res, null, this.application);
channels.set(connection, channel);
const { client } = channel;

@@ -69,3 +67,3 @@ const timer = setTimeout(() => {

finished = true;
channels.delete(connection);
channels.delete(client);
channel.error(504);

@@ -78,3 +76,3 @@ }, LONG_RESPONSE);

clearTimeout(timer);
channels.delete(connection);
channels.delete(client);
});

@@ -123,7 +121,10 @@

closeChannels() {
const { channels } = this;
for (const [connection, channel] of channels.entries()) {
channels.delete(connection);
channel.error(503);
connection.destroy();
for (const [client, channel] of channels.entries()) {
channels.delete(client);
if (channel.connection) {
channel.connection.terminate();
} else {
channel.error(503);
channel.req.connection.destroy();
}
}

@@ -136,3 +137,3 @@ }

});
if (this.channels.size === 0) {
if (channels.size === 0) {
await timeout(SHORT_TIMEOUT);

@@ -139,0 +140,0 @@ return;

{
"name": "metacom",
"version": "1.2.0",
"version": "1.3.0",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -5,0 +5,0 @@ "description": "Communication protocol for Metarhia stack with rpc, events, binary streams, memory and db access",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc