File tree 1 file changed +2
-6
lines changed
1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -135,19 +135,14 @@ export class Socket extends EventEmitter {
135
135
debug ( `received packet ${ packet . type } ` ) ;
136
136
this . emit ( "packet" , packet ) ;
137
137
138
- // Reset ping timeout on any packet, incoming data is a good sign of
139
- // other side's liveness
140
- this . resetPingTimeout (
141
- this . server . opts . pingInterval + this . server . opts . pingTimeout
142
- ) ;
143
-
144
138
switch ( packet . type ) {
145
139
case "ping" :
146
140
if ( this . transport . protocol !== 3 ) {
147
141
this . onError ( "invalid heartbeat direction" ) ;
148
142
return ;
149
143
}
150
144
debug ( "got ping" ) ;
145
+ this . pingTimeoutTimer . refresh ( ) ;
151
146
this . sendPacket ( "pong" ) ;
152
147
this . emit ( "heartbeat" ) ;
153
148
break ;
@@ -158,6 +153,7 @@ export class Socket extends EventEmitter {
158
153
return ;
159
154
}
160
155
debug ( "got pong" ) ;
156
+ clearTimeout ( this . pingTimeoutTimer ) ;
161
157
this . pingIntervalTimer . refresh ( ) ;
162
158
this . emit ( "heartbeat" ) ;
163
159
break ;
You can’t perform that action at this time.
0 commit comments