Merge pull request #165 from pali/lcp
authorPaul Mackerras <paulus@ozlabs.org>
Tue, 29 Dec 2020 03:10:40 +0000 (14:10 +1100)
committerGitHub <noreply@github.com>
Tue, 29 Dec 2020 03:10:40 +0000 (14:10 +1100)
pppd: Do not call update_link_stats() for every LcpSendEchoRequest() call

pppd/lcp.c

index 902b64a565c21d11940c39cb0fe5e10cf911848f..d7ea47106376cc3e3a43a6c7d55ed40a137994c2 100644 (file)
@@ -2339,12 +2339,10 @@ LcpSendEchoRequest (f)
      */
     if (lcp_echo_adaptive) {
        static unsigned int last_pkts_in = 0;
+       struct pppd_stats cur_stats;
 
-       update_link_stats(f->unit);
-       link_stats_valid = 0;
-
-       if (link_stats.pkts_in != last_pkts_in) {
-           last_pkts_in = link_stats.pkts_in;
+       if (get_ppp_stats(f->unit, &cur_stats) && cur_stats.pkts_in != last_pkts_in) {
+           last_pkts_in = cur_stats.pkts_in;
            return;
        }
     }