Moode Forum
Increase wait for eth0? - Printable Version

+- Moode Forum (http://moodeaudio.org/forum)
+-- Forum: moOde audio player (http://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (http://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: Increase wait for eth0? (/showthread.php?tid=2837)



Increase wait for eth0? - jonners - 07-29-2020

Is there a way that I can increase the wait time for an IP address to be assigned to eth0 from its current 9sec?


RE: Increase wait for eth0? - Tim Curtis - 07-29-2020

You could hack /var/www/command/worker.php. Currently it checks 5 times and there is a 3 sec delay between checks so total of 15 sec max wait.

The line to modify in the code block below is:  $eth0ip = waitForIpAddr('eth0', 5);

Change 5 to something > 5 then save the file and reboot.

Code:
//
workerLog('worker: -- Network');
//

// Check ETH0
$eth0 = sysCmd('ip addr list | grep eth0');
if (!empty($eth0)) {
    workerLog('worker: eth0 exists');
    // Wait for address (default), setting is on system config
    if ($_SESSION['eth0chk'] == '1') {
        $eth0ip = waitForIpAddr('eth0', 5);
    }
    else {
        $eth0ip = sysCmd("ip addr list eth0 | grep \"inet \" |cut -d' ' -f6|cut -d/ -f1");
    }
}
else {
    $eth0ip = '';
    workerLog('worker: eth0 does not exist');
}
!empty($eth0ip[0]) ? log_network_info('eth0') : workerLog('worker: eth0 address not assigned');



RE: Increase wait for eth0? - jonners - 07-29-2020

Done!
Thanks Tim for a such a speedy reply.


RE: Increase wait for eth0? - Tim Curtis - 07-29-2020

I'm curious do you know what might be causing DHCP to be so slow at handing out IP address? Usually is almost instant.


RE: Increase wait for eth0? - jonners - 07-30-2020

(07-29-2020, 10:17 PM)Tim Curtis Wrote: I'm curious do you know what might be causing DHCP to be so slow at handing out IP address? Usually is almost instant.

I'm using this as a wifi range extender, connected to Pi by ethernet: https://www.gl-inet.com/products/gl-mt300n-v2/
It takes a while to boot up and if I power that and the Pi at the same time the Pi (with a USB DAC) won't connect.
With my other system using a HAT I2S DAC the longer delay doesn't seem to be necessary.