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

chrome-net

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-net - npm Package Compare versions

Comparing version 1.2.4 to 1.3.0

46

index.js

@@ -11,6 +11,6 @@ /**

var EventEmitter = require('events').EventEmitter
var inherits = require('inherits')
var ipaddr = require('ipaddr.js')
var is = require('core-util-is')
var stream = require('stream')
var util = require('util')
var ipaddr = require('ipaddr.js')

@@ -61,3 +61,3 @@ /**

util.inherits(Server, EventEmitter)
inherits(Server, EventEmitter)

@@ -107,2 +107,3 @@ /**

}
exports.Server = Server

@@ -278,3 +279,3 @@ /**

util.inherits(Socket, stream.Duplex)
inherits(Socket, stream.Duplex)

@@ -483,6 +484,7 @@ /**

Socket.prototype.write = function (chunk, encoding, callback) {
var self = this
if (!Buffer.isBuffer(chunk))
chunk = new Buffer(chunk, encoding)
return stream.Duplex.prototype.write.call(this, chunk, encoding, callback)
return stream.Duplex.prototype.write.call(self, chunk, encoding, callback)
}

@@ -511,2 +513,3 @@

} else {
self._resetTimeout()
callback(null)

@@ -546,2 +549,3 @@ }

self.bytesRead += buffer.length
self._resetTimeout()

@@ -621,7 +625,39 @@ if (self.push(buffer)) // if returns true, then try to read more

/**
* Sets the socket to timeout after timeout milliseconds of inactivity on the socket.
* By default net.Socket do not have a timeout. When an idle timeout is triggered the
* socket will receive a 'timeout' event but the connection will not be severed. The
* user must manually end() or destroy() the socket.
*
* If timeout is 0, then the existing idle timeout is disabled.
*
* The optional callback parameter will be added as a one time listener for the 'timeout' event.
*
* @param {number} timeout
* @param {function} callback
*/
Socket.prototype.setTimeout = function (timeout, callback) {
var self = this
if (callback) self.once('timeout', callback)
self._timeoutMs = timeout
self._resetTimeout()
}
Socket.prototype._onTimeout = function () {
var self = this
self._timeout = null
self._timeoutMs = 0
self.emit('timeout')
}
Socket.prototype._resetTimeout = function () {
var self = this
if (self._timeout) {
clearTimeout(self._timeout)
}
if (self._timeoutMs) {
self._timeout = setTimeout(self._onTimeout, self.timeoutMs)
}
}
/**

@@ -628,0 +664,0 @@ * Disables the Nagle algorithm. By default TCP connections use the Nagle

33

package.json
{
"name": "chrome-net",
"version": "1.2.4",
"description": "Use the Node `net` API in Chrome Apps",
"main": "index.js",
"version": "1.3.0",
"author": "Feross Aboukhadijeh <feross@feross.org> (http://feross.org/)",
"bugs": {
"url": "https://github.com/feross/chrome-net/issues"
},
"contributors": [
"John Hiesey <john@hiesey.com>"
],
"dependencies": {
"core-util-is": "~1.0.1",
"inherits": "^2.0.1",
"ipaddr.js": "~0.1.2"

@@ -20,9 +27,3 @@ },

},
"scripts": {
"test": "tape test/*.js"
},
"repository": {
"type": "git",
"url": "git://github.com/feross/chrome-net.git"
},
"homepage": "https://github.com/feross/chrome-net",
"keywords": [

@@ -38,11 +39,11 @@ "chrome app",

],
"author": "Feross Aboukhadijeh <feross@feross.org> (http://feross.org/)",
"contributors": [
"John Hiesey <john@hiesey.com>"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/feross/chrome-net/issues"
"main": "index.js",
"repository": {
"type": "git",
"url": "git://github.com/feross/chrome-net.git"
},
"homepage": "https://github.com/feross/chrome-net"
"scripts": {
"test": "tape test/*.js"
}
}

Sorry, the diff of this file is too big to display

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