@@ -169,7 +169,7 @@ class Parser {
169169 if ( value !== this . timeoutValue ) {
170170 timers . clearTimeout ( this . timeout )
171171 if ( value ) {
172- this . timeout = timers . setTimeout ( onParserTimeout , value , this )
172+ this . timeout = timers . setTimeout ( onParserTimeout , value , new WeakRef ( this ) )
173173 // istanbul ignore else: only for jest
174174 if ( this . timeout . unref ) {
175175 this . timeout . unref ( )
@@ -613,16 +613,16 @@ class Parser {
613613}
614614
615615function onParserTimeout ( parser ) {
616- const { socket, timeoutType, client } = parser
616+ const { socket, timeoutType, client, paused } = parser . deref ( )
617617
618618 /* istanbul ignore else */
619619 if ( timeoutType === TIMEOUT_HEADERS ) {
620620 if ( ! socket [ kWriting ] || socket . writableNeedDrain || client [ kRunning ] > 1 ) {
621- assert ( ! parser . paused , 'cannot be paused while waiting for headers' )
621+ assert ( ! paused , 'cannot be paused while waiting for headers' )
622622 util . destroy ( socket , new HeadersTimeoutError ( ) )
623623 }
624624 } else if ( timeoutType === TIMEOUT_BODY ) {
625- if ( ! parser . paused ) {
625+ if ( ! paused ) {
626626 util . destroy ( socket , new BodyTimeoutError ( ) )
627627 }
628628 } else if ( timeoutType === TIMEOUT_IDLE ) {
0 commit comments