@@ -110,13 +110,11 @@ const {
110110 onStreamRead,
111111 kAfterAsyncWrite,
112112 kMaybeDestroy,
113- kUpdateTimer
113+ kUpdateTimer,
114+ kSession,
115+ setStreamTimeout
114116} = require ( 'internal/stream_base_commons' ) ;
115- const {
116- kTimeout,
117- setUnrefTimeout,
118- validateTimerDuration
119- } = require ( 'internal/timers' ) ;
117+ const { kTimeout } = require ( 'internal/timers' ) ;
120118const { isArrayBufferView } = require ( 'internal/util/types' ) ;
121119
122120const { FileHandle } = internalBinding ( 'fs' ) ;
@@ -163,7 +161,6 @@ const kSelectPadding = Symbol('select-padding');
163161const kSentHeaders = Symbol ( 'sent-headers' ) ;
164162const kSentTrailers = Symbol ( 'sent-trailers' ) ;
165163const kServer = Symbol ( 'server' ) ;
166- const kSession = Symbol ( 'session' ) ;
167164const kState = Symbol ( 'state' ) ;
168165const kType = Symbol ( 'type' ) ;
169166const kWriteGeneric = Symbol ( 'write-generic' ) ;
@@ -2546,35 +2543,7 @@ const setTimeout = {
25462543 configurable : true ,
25472544 enumerable : true ,
25482545 writable : true ,
2549- value : function ( msecs , callback ) {
2550- if ( this . destroyed )
2551- return ;
2552-
2553- // Type checking identical to timers.enroll()
2554- msecs = validateTimerDuration ( msecs ) ;
2555-
2556- // Attempt to clear an existing timer lear in both cases -
2557- // even if it will be rescheduled we don't want to leak an existing timer.
2558- clearTimeout ( this [ kTimeout ] ) ;
2559-
2560- if ( msecs === 0 ) {
2561- if ( callback !== undefined ) {
2562- if ( typeof callback !== 'function' )
2563- throw new ERR_INVALID_CALLBACK ( ) ;
2564- this . removeListener ( 'timeout' , callback ) ;
2565- }
2566- } else {
2567- this [ kTimeout ] = setUnrefTimeout ( this . _onTimeout . bind ( this ) , msecs ) ;
2568- if ( this [ kSession ] ) this [ kSession ] [ kUpdateTimer ] ( ) ;
2569-
2570- if ( callback !== undefined ) {
2571- if ( typeof callback !== 'function' )
2572- throw new ERR_INVALID_CALLBACK ( ) ;
2573- this . once ( 'timeout' , callback ) ;
2574- }
2575- }
2576- return this ;
2577- }
2546+ value : setStreamTimeout
25782547} ;
25792548Object . defineProperty ( Http2Stream . prototype , 'setTimeout' , setTimeout ) ;
25802549Object . defineProperty ( Http2Session . prototype , 'setTimeout' , setTimeout ) ;
0 commit comments