Even if there is no defined $@, it also need to alarm(0). 2009/10/15 Philip Gwyn <li...@artware.qc.ca>
> > Thank you for the patch. > > I do have a question though : could the alarm(0) be moved into the if($@) { > block? Would this be cleaner? > > > > On 14-Oct-2009 flw wrote: > > When it working with a server which used Non-IKC protocol, > > alarm( $self->{connect_timeout} ) will break user process via > > SIGALRM(default behaviour) > > > > Following patch is based on: > > $Id: ClientLite.pm 495 2009-05-08 19:46:42Z fil $ > > > > > > --- ClientLite.pm.orig 2009-10-14 11:35:38.000000000 +0800 > > +++ ClientLite.pm 2009-10-14 11:36:06.000000000 +0800 > > @@ -136,11 +136,11 @@ > > alarm( $self->{connect_timeout} ); > > $sock->print('WORLD'); # phase 003 > > chomp($resp=$sock->getline); > > - alarm( 0 ); > > die "Phase 003: $!\n" unless defined $resp; > > die "Didn't get UP from $name\n" unless $resp eq 'UP'; > > $DONE = 1; > > }; > > + alarm( 0 ); > > if($@) > > { > > $self->{error}=$error=$@; > >