~ubuntu-branches/ubuntu/trusty/ddclient/trusty-proposed

« back to all changes in this revision

Viewing changes to ddclient

  • Committer: Package Import Robot
  • Author(s): Angel Abad
  • Date: 2012-01-25 10:09:14 UTC
  • mfrom: (2.2.14 sid)
  • Revision ID: package-import@ubuntu.com-20120125100914-y84cth3n714sblyn
Tags: 3.8.0-11.4ubuntu1
* Merge from Debian testing.  Remaining changes:
  - Adjust ubuntu init script, set CONF file to /etc/ddclient.conf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1808
1808
    }
1809
1809
 
1810
1810
    if (defined $sd) {
1811
 
        ## send the request to the http server
1812
 
        verbose("CONNECTED: ", $use_ssl ? 'using SSL' : 'using HTTP');
1813
 
        verbose("SENDING:", $request);
 
1811
                ## send the request to the http server
 
1812
                verbose("CONNECTED: ", $use_ssl ? 'using SSL' : 'using HTTP');
 
1813
                verbose("SENDING:", $request);
1814
1814
 
1815
1815
        $0 = sprintf("%s - sending to %s port %s", $program, $peer, $port);
1816
 
        my $result = syswrite $sd, $rq;
1817
 
        if ($result != length($rq)) {
1818
 
            warning("cannot send to $peer:$port ($!).");
1819
 
            
1820
 
        } else {
1821
 
            my $timeout = 0;
1822
 
            local $SIG{'ALRM'} = sub { $timeout = 1; };
 
1816
                my $result = syswrite $sd, $rq;
 
1817
                if ($result != length($rq)) {
 
1818
                warning("cannot send to $peer:$port ($!).");
 
1819
                } else {
 
1820
                        $0 = sprintf("%s - reading from %s port %s", $program, $peer, $port);
 
1821
                        eval {
 
1822
                                local $SIG{'ALRM'} = sub { die "timeout";};
 
1823
                        alarm(opt('timeout')) if opt('timeout') > 0;
 
1824
                                while ($_ = <$sd>) {
 
1825
                        $0 = sprintf("%s - read from %s port %s", $program, $peer, $port);
 
1826
                                        verbose("RECEIVE:", "%s", define($_, "<undefined>"));
 
1827
                                        $reply .= $_ if defined $_;
 
1828
                        }
 
1829
                        if (opt('timeout') > 0) {
 
1830
                                        alarm(0);
 
1831
                        }
 
1832
                        };
 
1833
                        close($sd);
1823
1834
 
1824
 
            $0 = sprintf("%s - reading from %s port %s", $program, $peer, $port);
1825
 
            alarm(opt('timeout')) if opt('timeout') > 0;
1826
 
            while (!$timeout &&  ($_ = <$sd>)) {
1827
 
                $0 = sprintf("%s - read from %s port %s", $program, $peer, $port);
1828
 
                verbose("RECEIVE:", "%s", define($_, "<undefined>"));
1829
 
                $reply .= $_ if defined $_;
1830
 
            }
1831
 
            if (opt('timeout') > 0) {
1832
 
                alarm(0);
1833
 
            }
1834
 
            close($sd);
1835
 
            if ($timeout) {
1836
 
                warning("TIMEOUT: %s after %s seconds", $to, opt('timeout'));
1837
 
                $reply = '';
1838
 
            }
1839
 
            $reply = '' if !defined $reply;
1840
 
        }
 
1835
                        if ($@ and $@ =~ /timeout/) {
 
1836
                                warning("TIMEOUT: %s after %s seconds", $to, opt('timeout'));
 
1837
                                $reply = '';
 
1838
                }
 
1839
                        $reply = '' if !defined $reply;
 
1840
                }
1841
1841
    }
1842
1842
    $0 = sprintf("%s - closed %s port %s", $program, $peer, $port);
1843
1843