File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -233,23 +233,22 @@ impl LocalMetaService {
233233}
234234
235235fn next_port ( ) -> u16 {
236- let base = get_machine_unique_base_port ( ) ;
237- let sequence = GlobalSequence :: next ( ) as u16 ;
238-
239- let port_offset = sequence % 10_000 ;
240- let candidate_port = base. saturating_add ( port_offset) . max ( 19_000 ) ;
241-
242- if is_port_available ( candidate_port) {
243- return candidate_port;
244- }
245-
246236 match find_available_port ( ) {
247237 Ok ( port) => {
248- warn ! ( "Calculated port {candidate_port} not available, using {port} instead" ) ;
249238 port
250239 }
251240 Err ( _) => {
252- warn ! ( "No available ports found, returning calculated port {candidate_port}" ) ;
241+ let base = get_machine_unique_base_port ( ) ;
242+ let sequence = GlobalSequence :: next ( ) as u16 ;
243+
244+ let port_offset = sequence % 10_000 ;
245+ let candidate_port = base. saturating_add ( port_offset) . max ( 19_000 ) ;
246+
247+ if is_port_available ( candidate_port) {
248+ return candidate_port;
249+ }
250+
251+ warn ! ( "Failed to find available port, returning fallback port {candidate_port}" ) ;
253252 candidate_port
254253 }
255254 }
You can’t perform that action at this time.
0 commit comments