From 3f0fe04e423239cd11048283136b1f8168c2b101 Mon Sep 17 00:00:00 2001 From: Brian Yarger Date: Sat, 18 Apr 2015 17:55:16 -0700 Subject: [PATCH] added pause_ms for adding a small pause after each window is created. This allows me to connect to my jump host without some of the session getting closed due to sshd thinking it was a denail of service --- csshX | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/csshX b/csshX index a9d6015..e2d9876 100755 --- a/csshX +++ b/csshX @@ -38,6 +38,7 @@ my @config_keys = qw( session_max ping_test ping_timeout ssh interleave master_settings_set slave_settings_set sorthosts clusters list_clusters bash_env + pause_ms ); foreach my $prop (@config_keys) { @@ -74,7 +75,8 @@ sub new { no_growl => 0, interleave => 0, hosts => [], - clusters => {} + clusters => {}, + pause_ms => 0 }, ref($pack) || $pack; ($obj->{osver} = (uname())[2]) =~ s/^(\d+)(\.\d+).*/"10.".($1-4)."$2"/e; @@ -91,7 +93,8 @@ sub new { 'session_max=i', 'help|h', 'man|m', 'version|v', 'ssh=s', 'hosts=s@', 'remote_command=s','no_growl', 'master_settings_set|mss=s', 'slave_settings_set|sss=s', - 'interleave|i=i', 'sorthosts', 'list_clusters', 'bash_env' + 'interleave|i=i', 'sorthosts', 'list_clusters', 'bash_env', + 'pause_ms|pm=i' ) || $obj->pod(-msg => "$0: bad usage\n"); # Load any extra configs specified in config file or command line @@ -1275,6 +1278,10 @@ sub new { $slave->set_space($config->space) if $config->space; $slave->set_settings_set($config->slave_settings_set) if $config->slave_settings_set; + # sleep for ten milliseconds to avoid DOS detection + if ($config->pause_ms > 0) { + select(undef, undef, undef, $config->pause_ms / 1000); + } } $greeting .= "done\n"; @@ -2417,6 +2424,12 @@ as opposed to the default clusterA3 clusterB1 clusterB2 clusterB3 +=item B<--pause_ms>, B<--pm> I + +Pause this many miliiseconds after each window is created. Helpful for avoiding denial of service from sshd when using a jump host for lots of connections. + +The value is in milliseconds. (default: 0) + =item B<--bash_env> Dump environment for bash completion of clusters - see L