@@ -365,6 +365,7 @@ defmodule Tmate.Session do
365
365
daemon_set_env ( state , "tmate_ssh_ro" , ssh_cmd_ro )
366
366
if ! ssh_only , do: daemon_set_env ( state , "tmate_web" , web_url )
367
367
daemon_set_env ( state , "tmate_ssh" , ssh_cmd )
368
+ set_env_num_clients ( state , 0 )
368
369
369
370
daemon_set_env ( state , "tmate_reconnection_data" , pack_and_sign! ( new_reconnection_data ) )
370
371
@@ -610,9 +611,14 @@ defmodule Tmate.Session do
610
611
num_clients = Kernel . map_size ( state . clients )
611
612
msg = "A mate has #{ verb } (#{ client . ip_address } ) -- " <>
612
613
"#{ num_clients } client#{ if num_clients > 1 , do: 's' } currently connected"
614
+ set_env_num_clients ( state , num_clients )
613
615
notify_daemon ( state , msg )
614
616
end
615
617
618
+ defp set_env_num_clients ( state , num_clients ) do
619
+ daemon_set_env ( state , "tmate_num_clients" , "#{ num_clients } " )
620
+ end
621
+
616
622
defp update_client_size ( state , ref , size ) do
617
623
client = Map . fetch! ( state . clients , ref )
618
624
client = Map . merge ( client , % { size: size } )
0 commit comments