@@ -167,7 +167,7 @@ class Parser {
167167 if ( value !== this . timeoutValue ) {
168168 timers . clearTimeout ( this . timeout )
169169 if ( value ) {
170- this . timeout = timers . setTimeout ( onParserTimeout , value , this )
170+ this . timeout = timers . setTimeout ( onParserTimeout , value , new WeakRef ( this ) )
171171 // istanbul ignore else: only for jest
172172 if ( this . timeout . unref ) {
173173 this . timeout . unref ( )
@@ -611,16 +611,16 @@ class Parser {
611611}
612612
613613function onParserTimeout ( parser ) {
614- const { socket, timeoutType, client } = parser
614+ const { socket, timeoutType, client, paused } = parser . deref ( )
615615
616616 /* istanbul ignore else */
617617 if ( timeoutType === TIMEOUT_HEADERS ) {
618618 if ( ! socket [ kWriting ] || socket . writableNeedDrain || client [ kRunning ] > 1 ) {
619- assert ( ! parser . paused , 'cannot be paused while waiting for headers' )
619+ assert ( ! paused , 'cannot be paused while waiting for headers' )
620620 util . destroy ( socket , new HeadersTimeoutError ( ) )
621621 }
622622 } else if ( timeoutType === TIMEOUT_BODY ) {
623- if ( ! parser . paused ) {
623+ if ( ! paused ) {
624624 util . destroy ( socket , new BodyTimeoutError ( ) )
625625 }
626626 } else if ( timeoutType === TIMEOUT_IDLE ) {
0 commit comments