安卓4.4pppoe拨号间隔及轮次修改

最近在修改pppoe,需要调整pppoe的时间间隔,需求是第一次拨号3s无响应后,等待8s,8s后无反应再次等待8s,8s还是没有反应,进行下一轮拨号,一共拨号5轮,5轮拨号结束后返回拨号失败的提示;具体修改的文件如下(修改处为后面加注释的地方);
1,拨号间隔的修改

externel/ppp/pppd/plugins/rp-pppoe/discovery.c
-----------------------------------------------------------------------------------
void discovery(PPPoEConnection *conn)
{
    do {
        padiAttempts++;
        if (padiAttempts > MAX_PADI_ATTEMPTS) {
            if (persist) {
                padiAttempts = 0;
                timeout = conn->discoveryTimeout;
                printErr("Timeout waiting for PADO packets");
            } else {
                rp_fatal("FATAL: Timeout waiting for PADO packets");
            }
        }
        syslog( LOG_INFO, "sendPADI\n");
        sendPADI(conn);

        conn->discoveryState = STATE_SENT_PADI;
        gettimeofday(&current_time, NULL);
        waitForPADO(conn, timeout);
        gettimeofday(&current_time, NULL);
        /* If we're just probing for access concentrators, don't do
        exponential backoff.  This reduces the time for an unsuccessful
        probe to 15 seconds. */
        if (exponential_backoff && !conn->printACNames) {
            timeout = 8;             //后面拨号的间隔
        }       

externel/ppp/pppd/plugins/rp-pppoe/pppoe.h
-------------------------------------------------------------------------------------
/* How many PADI/PADS attempts? */
#define MAX_PADI_ATTEMPTS 4 			//拨号的次数

/* Initial timeout for PADO/PADS */
#define PADI_TIMEOUT 3					//第一次拨号的间隔

2,拨号轮次的修改

frameworks/base/pppoe/java/android/net/pppoe/PppoeStateTracker.java
------------------------------------------------------------------------------
 public void waitForConnected() {
    log(2, TAG, "waitForConnected start");
    TimerTask task = new TimerTask(){
        public void run() {
            log(2, TAG, "waitForConnected, timeout: " + mConnectTimerTimeout);
            int timeout = SystemProperties.getInt("net.ppp.waittime",11);//一次拨号总超时时间
            if(mConnectTimerTimeout >= timeout) {
                setPppoeState(false, PppoeManager._EVENT_CONNECT_FAILED, "650");
                return;
              
  private String mIsCipher = null;
  private String mPassWord2 = null;
  private String mIpType = null;
  private int RetryCount = 4; //拨号轮次,从0开始,4代表拨号5次;

版权声明:本文为weixin_43866431原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。