Skip to content
Browse files

Simple auto-reconnect in example

  • Loading branch information...
1 parent c067318 commit ce1243ddf5373fb51c4bc63e4b5babd3957d99bb @sanko committed Jun 21, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 examples/client.pl
View
3 examples/client.pl
@@ -28,7 +28,8 @@
on_error => sub {
my ($msn, $msg, $fatal) = @_;
warn ucfirst sprintf '%serror: %s', ($fatal ? 'fatal ' : ''), $msg;
- $fatal? $cv->send : $msn->connect
+ return if !$fatal;
+ $msn->connected ? $msn->connect : $cv->send # auto-reconnect
}
);
$cv->recv;

0 comments on commit ce1243d

Please sign in to comment.
Something went wrong with that request. Please try again.