Commit 962c042
committed
http: destroy clean incoming messages in one tick
When an incoming message is destroyed after being fully received with
no error, complete the destroy synchronously instead of deferring the
callback with process.nextTick(). The deferral only exists so that
'error' listeners attached right after destroy(err) still receive the
error, which cannot matter when there is no error. 'close' is still
emitted asynchronously by the stream machinery.
Reduces the per-request nextTick count of a hello-world HTTP server
from 6 to 5.
Signed-off-by: Matteo Collina <hello@matteocollina.com>1 parent 803bd87 commit 962c042
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
302 | 309 | | |
303 | 310 | | |
304 | 311 | | |
| |||
0 commit comments