summaryrefslogtreecommitdiffstats
path: root/lib/App/Termcast.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/App/Termcast.pm')
-rw-r--r--lib/App/Termcast.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/App/Termcast.pm b/lib/App/Termcast.pm
index dc9a6c0..df5870c 100644
--- a/lib/App/Termcast.pm
+++ b/lib/App/Termcast.pm
@@ -146,6 +146,10 @@ sub _build_socket {
return $socket;
}
+before clear_socket => sub {
+ Carp::carp("Lost connection to server ($!), reconnecting...");
+};
+
has pty => (
traits => ['NoGetopt'],
is => 'rw',
@@ -214,7 +218,6 @@ sub write_to_termcast {
my ($rout, $wout, $eout);
my $ready = select(undef, $wout = $win, $eout = $ein, $self->timeout);
if (!$ready || $self->_socket_ready($eout)) {
- Carp::carp("Lost connection to server ($!), reconnecting...");
$self->clear_socket;
return $self->write_to_termcast(@_);
}
@@ -245,7 +248,6 @@ sub run {
select($rout = $rin, undef, $eout = $ein, undef);
if ($self->_socket_ready($eout)) {
- Carp::carp("Lost connection to server ($!), reconnecting...");
$self->clear_socket;
}