| 
					
				 | 
			
			
				@@ -450,6 +450,9 @@ circpad_is_token_removal_supported(circpad_machine_runtime_t *mi) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /* Machines that do want token removal are less sensitive to performance. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * Let's spend some time to check that our state is consistent and sane */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const circpad_state_t *state = circpad_machine_current_state(mi); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (BUG(!state)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     tor_assert_nonfatal(state->token_removal != CIRCPAD_TOKEN_REMOVAL_NONE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     tor_assert_nonfatal(state->histogram_len == mi->histogram_len); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     tor_assert_nonfatal(mi->histogram_len != 0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1091,8 +1094,11 @@ circpad_machine_remove_token(circpad_machine_runtime_t *mi) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   state = circpad_machine_current_state(mi); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /* If we are not in a padding state (like start or end), we're done */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (!state) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /* Don't remove any tokens if we're not doing token removal */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  if (!state || state->token_removal == CIRCPAD_TOKEN_REMOVAL_NONE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (state->token_removal == CIRCPAD_TOKEN_REMOVAL_NONE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   current_time = monotime_absolute_usec(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1111,10 +1117,6 @@ circpad_machine_remove_token(circpad_machine_runtime_t *mi) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     timer_disable(mi->padding_timer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /* If we are not in a padding state (like start or end), we're done */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  if (!state) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /* Perform the specified token removal strategy */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   switch (state->token_removal) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     case CIRCPAD_TOKEN_REMOVAL_CLOSEST_USEC: 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1676,6 +1678,9 @@ circpad_estimate_circ_rtt_on_received(circuit_t *circ, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const circpad_state_t *state = circpad_machine_current_state(mi); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (BUG(!state)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /* Since monotime is unpredictably expensive, only update this field 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * if rtt estimates are needed. Otherwise, stop the rtt update. */ 
			 |