(socket, state)
| 865 | } |
| 866 | |
| 867 | function socketOnDrain(socket, state) { |
| 868 | const needPause = state.outgoingData > socket.writableHighWaterMark; |
| 869 | |
| 870 | // If we previously paused, then start reading again. |
| 871 | if (socket._paused && !needPause) { |
| 872 | socket._paused = false; |
| 873 | if (socket.parser) |
| 874 | socket.parser.resume(); |
| 875 | socket.resume(); |
| 876 | } |
| 877 | |
| 878 | const msg = socket._httpMessage; |
| 879 | // Only emit 'drain' once the message has no data pending anywhere, so that |
| 880 | // msg.writableLength === 0 when the event fires. socketOnDrain is called |
| 881 | // synchronously from updateOutgoingData during _flushOutput, at which point |
| 882 | // the bytes we just handed to the socket (or the stale outputSize) mean |
| 883 | // the message is not actually drained yet - we wait for the socket's |
| 884 | // own 'drain' event instead. |
| 885 | if (msg && !msg.finished && msg[kNeedDrain] && msg.writableLength === 0) { |
| 886 | msg[kNeedDrain] = false; |
| 887 | msg.emit('drain'); |
| 888 | } |
| 889 | } |
| 890 | |
| 891 | function socketOnTimeout() { |
| 892 | const req = this.parser?.incoming; |
no test coverage detected
searching dependent graphs…