joyent/node — pull request #8203 by chrisdickinson (2014-08-19 21:45:51+00:00)
Title: net,stream: add isPaused, Socket should not read() when paused

If the socket has been manually paused by the user before `afterConnect` is called, it should not call [`.read(0)`](https://github.com/joyent/node/blob/master/lib/net.js#L971-L974), since this will trigger a `.readStart` that will keep the event loop alive.

This introduces a new public function -- `readable.isPaused()` -- in an attempt to cut down on the number of places where Socket is reaching into stream internals. I'm amenable to punting on this for now, but I wanted to start a conversation about encapsulating `_readableState` in the future.

This fixes #8200.