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

sockit-to-me

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sockit-to-me - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

package.json
{
"name": "sockit-to-me",
"version": "0.2.1",
"version": "0.2.2",
"author": "Ghislain 'Aus' Lacroix <aus@mozilla.com>",

@@ -5,0 +5,0 @@ "description": "A synchronous socket API for node.js.",

@@ -21,5 +21,9 @@ var assert = require('assert');

var subject = null;
// global flag set to true if we kill the server
// needed for the close / disconnect
var server_killed = false;
setup(function(done) {
subject = new Sockit.Sockit();
server_killed = false;
// Start the child process.

@@ -42,15 +46,19 @@ server = ChildProcess.fork(__dirname + '/../test_support/server.js');

subject.close();
// Register listener to shutdown child process once the server has
// successfully closed it's listening socket.
server.on('message', function(message) {
// Server has actually stopped.
if(message.reply == 'stopped') {
// Disconnect child process.
server.disconnect();
// Teardown complete.
done();
}
});
// Ask server to stop.
server.send({ command: 'stop' });
if (!server_killed) {
// Register listener to shutdown child process once the server has
// successfully closed it's listening socket.
server.on('message', function(message) {
// Server has actually stopped.
if(message.reply == 'stopped') {
// Disconnect child process.
server.disconnect();
// Teardown complete.
done();
}
});
// Ask server to stop.
server.send({ command: 'stop' });
} else {
done();
}
});

@@ -214,2 +222,33 @@

test('socket closing', function(done) {
subject.setPollTimeout(1000);
// Register a listener to ensure that the server really is ready
server.on('message', function(message) {
// Connected, ask server to send NOTHING.
if(message.reply == 'connected') {
var err;
server.kill('SIGKILL');
server_killed = true;
try {
// Read the response.
var response = subject.read(helo.length);
}
catch(e) {
err = e;
}
assert.ok(err instanceof Error);
done();
}
})
// Connect to server.
subject.connect({ host: host, port: port });
});
});

@@ -216,0 +255,0 @@

Sorry, the diff of this file is not supported yet

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