fix(server): reschedule keep alive interval timer once a pong is received
`KeepAliveState` did not transition from `PingSent` to `Scheduled` after a pong was received. This prevented more than one ping to be sent by the server. This fix checks if `ping_sent_at` has already been cleared by `Ponger::poll` when `KeepAliveState::PingSent` state is active. Fixes #2310
This commit is contained in:
		
				
					committed by
					
						 Sean McArthur
						Sean McArthur
					
				
			
			
				
	
			
			
			
						parent
						
							f288641792
						
					
				
				
					commit
					2a938d96ae
				
			| @@ -442,7 +442,16 @@ impl KeepAlive { | ||||
|                 let interval = shared.last_read_at() + self.interval; | ||||
|                 self.timer.reset(interval); | ||||
|             } | ||||
|             KeepAliveState::Scheduled | KeepAliveState::PingSent => (), | ||||
|             KeepAliveState::PingSent => { | ||||
|                 if shared.is_ping_sent() { | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 self.state = KeepAliveState::Scheduled; | ||||
|                 let interval = shared.last_read_at() + self.interval; | ||||
|                 self.timer.reset(interval); | ||||
|             } | ||||
|             KeepAliveState::Scheduled => (), | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user