Skip to content

Why http2session.socket.bufferSize is always zero? #21631

Description

@micooz
  • Version: v10.4.1
  • Platform: macOS 10.13.5
  • Subsystem: net,http2

I encountered a problem that I couldn't get expected bufferSize from http2session, http2session.socket.bufferSize is always zero.

Reproduce Code

I write a test similar to test-net-buffersize.js:

const assert = require('assert');
const http2 = require('http2');

const server = http2.createServer();

server.listen(0, () => {
  const session = http2.connect(`http://localhost:${server.address().port}`);
  const stream = session.request({ ':path': '/' }, { endStream: false });

  for (let i = 1; i < 10; i++) {
    assert(stream.writable);
    stream.write('a');
    assert.strictEqual(session.socket.bufferSize, i); // AssertionError
  }

  stream.close();
});

Is it correct way to obtain bufferSize from http2 session? I need this value to throttle uploads like net.Socket do.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues and PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions