@@ -212,6 +212,7 @@ impl ActiveTunnel {
212
212
213
213
const VSCODE_CLI_TUNNEL_TAG : & str = "vscode-server-launcher" ;
214
214
const VSCODE_CLI_FORWARDING_TAG : & str = "vscode-port-forward" ;
215
+ const OWNED_TUNNEL_TAGS : & [ & str ] = & [ VSCODE_CLI_TUNNEL_TAG , VSCODE_CLI_FORWARDING_TAG ] ;
215
216
const MAX_TUNNEL_NAME_LENGTH : usize = 20 ;
216
217
217
218
fn get_host_token_from_tunnel ( tunnel : & Tunnel ) -> String {
@@ -635,7 +636,7 @@ impl DevTunnels {
635
636
"Tunnel limit hit, trying to recycle an old tunnel"
636
637
) ;
637
638
638
- let existing_tunnels = self . list_all_server_tunnels ( ) . await ?;
639
+ let existing_tunnels = self . list_tunnels_with_tag ( OWNED_TUNNEL_TAGS ) . await ?;
639
640
640
641
let recyclable = existing_tunnels
641
642
. iter ( )
@@ -667,13 +668,15 @@ impl DevTunnels {
667
668
}
668
669
}
669
670
670
- async fn list_all_server_tunnels ( & mut self ) -> Result < Vec < Tunnel > , AnyError > {
671
+ async fn list_tunnels_with_tag (
672
+ & mut self ,
673
+ tags : & [ & ' static str ] ,
674
+ ) -> Result < Vec < Tunnel > , AnyError > {
671
675
let tunnels = spanf ! (
672
676
self . log,
673
677
self . log. span( "dev-tunnel.listall" ) ,
674
678
self . client. list_all_tunnels( & TunnelRequestOptions {
675
- tags: vec![ self . tag. to_string( ) ] ,
676
- require_all_tags: true ,
679
+ tags: tags. iter( ) . map( |t| t. to_string( ) ) . collect( ) ,
677
680
..Default :: default ( )
678
681
} )
679
682
)
@@ -711,7 +714,7 @@ impl DevTunnels {
711
714
preferred_name : Option < & str > ,
712
715
mut use_random_name : bool ,
713
716
) -> Result < String , AnyError > {
714
- let existing_tunnels = self . list_all_server_tunnels ( ) . await ?;
717
+ let existing_tunnels = self . list_tunnels_with_tag ( & [ self . tag ] ) . await ?;
715
718
let is_name_free = |n : & str | {
716
719
!existing_tunnels. iter ( ) . any ( |v| {
717
720
v. status
0 commit comments