• Robert Sprowson's avatar
    Fix for claiming other socket's internet events · 9a0d8417
    Robert Sprowson authored
    Various sloppy management of the socket number meant that NetTime would erroneously claim the internet event for a socket it wasn't using (either before use, or in certain circumstances after use).
    
    In the case observed, socket 0 is opened by a ROM module (DHCP), then NetTime is loaded from disc but not yet attempting a connect (eg. link is down so the state machine idle) the event handler is then higher up the event chain and catching socket 0 events. Subsequent attempts to use DHCP then fail because it never gets the async replies on its socket.
    
    machine.c: Set global sockno to -1 before use. Check the return value of socket() before merrily applying socket options. On closing, set sockno back to -1 via utility function closeconnect().
    
    Version 0.44. Tagged as 'NetTime-0_44'
    9a0d8417
machine 17 KB