]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/pppoe/discovery.c
pppoe: Split function discovery() into phases discovery1() and discovery2()
[ppp.git] / pppd / plugins / pppoe / discovery.c
index 5569f3e06898c240c894da2454039349c468f54a..1c55b3680521e6501e25caf2db967cb173e7bedf 100644 (file)
@@ -605,19 +605,18 @@ waitForPADS(PPPoEConnection *conn, int timeout)
 }
 
 /**********************************************************************
-*%FUNCTION: discovery
+*%FUNCTION: discovery1
 *%ARGUMENTS:
 * conn -- PPPoE connection info structure
 *%RETURNS:
 * Nothing
 *%DESCRIPTION:
-* Performs the PPPoE discovery phase
+* Performs the PPPoE discovery phase 1
 ***********************************************************************/
 void
-discovery(PPPoEConnection *conn)
+discovery1(PPPoEConnection *conn)
 {
     int padiAttempts = 0;
-    int padrAttempts = 0;
     int timeout = conn->discoveryTimeout;
 
     do {
@@ -634,8 +633,23 @@ discovery(PPPoEConnection *conn)
 
        timeout *= 2;
     } while (conn->discoveryState == STATE_SENT_PADI);
+}
+
+/**********************************************************************
+*%FUNCTION: discovery2
+*%ARGUMENTS:
+* conn -- PPPoE connection info structure
+*%RETURNS:
+* Nothing
+*%DESCRIPTION:
+* Performs the PPPoE discovery phase 2
+***********************************************************************/
+void
+discovery2(PPPoEConnection *conn)
+{
+    int padrAttempts = 0;
+    int timeout = conn->discoveryTimeout;
 
-    timeout = conn->discoveryTimeout;
     do {
        padrAttempts++;
        if (got_sigterm || padrAttempts > conn->discoveryAttempts) {