New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tchannel

Package Overview
Dependencies
Maintainers
8
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tchannel - npm Package Compare versions

Comparing version 3.5.40 to 3.5.41

40

benchmarks/index.js

@@ -23,3 +23,4 @@ // Copyright (c) 2015 Uber Technologies, Inc.

/* eslint no-console: 0 */
/* eslint-disable no-console, no-process-env */
var childProcess = require('child_process');

@@ -44,2 +45,7 @@ var parseArgs = require('minimist');

var TorchCommand = ['sudo', 'torch', '{pid}', 'raw', '{time}'];
if (process.env.TORCH_COMMAND) {
TorchCommand = process.env.TORCH_COMMAND.split(/\s+/);
}
module.exports = BenchmarkRunner;

@@ -73,3 +79,3 @@

self.instanceCount = INSTANCE_COUNT;
self.instanceCount = opts.instances || INSTANCE_COUNT;
self.ports = {

@@ -333,3 +339,4 @@ serverPort: SERVER_PORT,

BenchmarkRunner.prototype.startTorch = function startTorch() {
BenchmarkRunner.prototype.torchCommand =
function torchCommand() {
var self = this;

@@ -345,6 +352,3 @@

var torchPid;
var torchFile = self.opts.torchFile;
var torchTime = self.opts.torchTime || '30';
var torchDelay = self.opts.torchDelay || 10 * 1000;
var torchType = self.opts.torchType || 'raw';
var torchIndex = self.opts.torchIndex || 0;

@@ -360,6 +364,24 @@

return TorchCommand.map(function each(part) {
if (part === '{pid}') {
return torchPid;
} else if (part === '{time}') {
return torchTime;
} else {
return part;
}
});
};
BenchmarkRunner.prototype.startTorch =
function startTorch() {
var self = this;
var torchFile = self.opts.torchFile;
var torchDelay = self.opts.torchDelay || 10 * 1000;
var cmd = self.torchCommand();
setTimeout(function delayTorching() {
var torchProc = childProcess.spawn('sudo', [
'torch', torchPid, torchType, torchTime
]);
var torchProc = childProcess.spawn(cmd[0], cmd.slice(1));
torchProc.stdout.pipe(

@@ -366,0 +388,0 @@ fs.createWriteStream(torchFile)

@@ -36,2 +36,4 @@ // Copyright (c) 2015 Uber Technologies, Inc.

var MAX_PENDING_SOCKET_WRITE_REQ = 100;
function TChannelConnection(channel, socket, direction, socketRemoteAddr) {

@@ -163,4 +165,4 @@ assert(socketRemoteAddr !== channel.hostPort,

self.handler.write = function write(buf, done) {
self.socket.write(buf, null, done);
self.handler.write = function write(buf) {
self.writeToSocket(buf);
};

@@ -231,2 +233,29 @@

TChannelConnection.prototype.writeToSocket =
function writeToSocket(buf) {
var self = this;
if (self.socket._writableState.buffer.length >
MAX_PENDING_SOCKET_WRITE_REQ
) {
var error = errors.SocketWriteFullError({
pendingWrites: self.socket._writableState.buffer.length
});
self.logger.warn('resetting connection due to write backup',
self.extendLogInfo({
pendingWrites: self.socket._writableState.buffer.length,
totalFastBufferBytes: self.socket._writableState.length,
lastBufferLength: buf.length,
error: error
})
);
// NUKE THE SOCKET
self.resetAll(error);
return;
}
self.socket.write(buf);
};
TChannelConnection.prototype.sendProtocolError =

@@ -233,0 +262,0 @@ function sendProtocolError(type, err) {

@@ -487,2 +487,8 @@ // Copyright (c) 2015 Uber Technologies, Inc.

Errors.SocketWriteFullError = TypedError({
type: 'tchannel.socket.write-full',
message: 'Could not write to socket; socket has {pendingWrites} writes',
pendingWrites: null
});
Errors.TChannelConnectionCloseError = TypedError({

@@ -753,2 +759,3 @@ type: 'tchannel.connection.close',

case 'tchannel.server.listen-failed':
case 'tchannel.socket.write-full':
case 'tchannel.top-level-register':

@@ -755,0 +762,0 @@ case 'tchannel.top-level-request':

@@ -369,3 +369,3 @@ // Copyright (c) 2015 Uber Technologies, Inc.

frame.setId(self.outreq.id);
self.outreq.conn.socket.write(frame.buffer);
self.outreq.conn.writeToSocket(frame.buffer);
if (frame.bodyRW.lazy.isFrameTerminal(frame)) {

@@ -572,3 +572,3 @@ self.alive = false;

frame.setId(self.inreq.id);
self.inreq.conn.socket.write(frame.buffer);
self.inreq.conn.writeToSocket(frame.buffer);
if (frame.bodyRW.lazy.isFrameTerminal(frame)) {

@@ -575,0 +575,0 @@ self.conn.ops.popOutReq(self.id, self.extendLogInfo({

@@ -25,2 +25,5 @@ // Copyright (c) 2015 Uber Technologies, Inc.

// NOTE: this RNG is not suitable for real usage, it exists only for a
// predictable test/benchmark fixture.
function LCG(seed) {

@@ -27,0 +30,0 @@ var self = this;

@@ -5,3 +5,3 @@ {

"author": "mranney@uber.com",
"version": "3.5.40",
"version": "3.5.41",
"scripts": {

@@ -14,3 +14,3 @@ "lint": "eslint $(git ls-files | grep '.js$')",

"tcurl-link-test": "./test/link_tcurl.sh",
"check-benchmark": "node benchmarks -- -r 10000 -p 10000",
"check-benchmark": "node benchmarks -- -r 10000 -p 1000",
"take-benchmark": "make -C benchmarks take",

@@ -49,2 +49,3 @@ "take-relay-benchmark": "make -C benchmarks take_relay",

"thriftrw": "3.0.1",
"xorshift": "^0.2.0",
"xtend": "^4.0.0"

@@ -51,0 +52,0 @@ },

@@ -53,2 +53,23 @@ // Copyright (c) 2015 Uber Technologies, Inc.

TestBody.testWith('LazyFrame.readFrom, invalid type', function t(assert) {
var res = v2.LazyFrame.RW.readFrom(new Buffer([
0x00, 0x15, // size: 2
0x50, // type: 1
0x00, // reserved:1
0x00, 0x00, 0x00, 0x01, // id:4
0x00, 0x00, 0x00, 0x00, // reserved:4
0x00, 0x00, 0x00, 0x00, // reserved:4
0x04, 0x64, 0x6f, 0x67, 0x65 // junk bytes
]), 0);
var err = res.err;
assert.equal(err.type, 'tchannel.invalid-frame-type');
assert.equal(err.typeNumber, 80);
assert.end();
});
TestBody.testWith('LazyFrame.readBody', function t(assert) {

@@ -55,0 +76,0 @@ var frame = v2.LazyFrame.RW.readFrom(new Buffer([

@@ -23,6 +23,4 @@ // Copyright (c) 2015 Uber Technologies, Inc.

var LCG = require('../lib/lcg');
var xorshift = require('xorshift');
var rng = new LCG();
module.exports = Span;

@@ -93,3 +91,3 @@ module.exports.Endpoint = Endpoint;

self.id = self.traceid = [rng.rand(), rng.rand()];
self.id = self.traceid = xorshift.randomint();
};

@@ -101,3 +99,3 @@

self.id = [rng.rand(), rng.rand()];
self.id = xorshift.randomint();
};

@@ -104,0 +102,0 @@

@@ -105,5 +105,5 @@ // Copyright (c) 2015 Uber Technologies, Inc.

var lazyFrame = new LazyFrame(size, type, id, frameBuffer);
lazyFrame.bodyRW = Frame.Types[lazyFrame.type].RW;
var BodyType = Frame.Types[lazyFrame.type];
if (!lazyFrame.bodyRW) {
if (!BodyType) {
return bufrw.ReadResult.error(errors.InvalidFrameTypeError({

@@ -114,2 +114,4 @@ typeNumber: lazyFrame.type

lazyFrame.bodyRW = BodyType.RW;
return bufrw.ReadResult.just(offset, lazyFrame);

@@ -116,0 +118,0 @@ }

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