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.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/App/Termcast.pm b/lib/App/Termcast.pm
index df5870c..132a2b7 100644
--- a/lib/App/Termcast.pm
+++ b/lib/App/Termcast.pm
@@ -138,10 +138,13 @@ has socket => (
sub _build_socket {
my $self = shift;
- my $socket = IO::Socket::INET->new(PeerAddr => $self->host,
- PeerPort => $self->port);
- die "Couldn't connect to " . $self->host . ": $!"
- unless $socket;
+ my $socket;
+ while (!$socket) {
+ $socket = IO::Socket::INET->new(PeerAddr => $self->host,
+ PeerPort => $self->port);
+ Carp::carp "Couldn't connect to " . $self->host . ": $!"
+ unless $socket;
+ }
$socket->syswrite($self->establishment_message);
return $socket;
}