[MAC] [BUGS] [FIX] Macintosh 2.8 Socket issue with disconnected tcp/ip in sqMacNetwork.c

John M McIntosh johnmci at smalltalkconsulting.com
Thu Aug 31 05:30:46 UTC 2000


If you disconnect your machine from the internet or your intranet, then
start Squeak with a 2.8 VM and attempt to connect to a remote host using the
host IP address versus it's domain name, you will crash your powerbook.

However if you need to first resolve a domain name Squeak will complain and
stop, but this isn't always the case with some of the Squeak internet code
where a name might have been resolved to an IP address before you
disconnected.

To fix the problem I had to make a change  to the sqMacNetwork.c code. I
will be issuing a new Macintosh VM (2.8.2) in a day or two once I've
confirmed that any issues with sleeping a powerbook, and/or disconnecting
from ethernet or a dialup PPP connection have been resolved. It also means a
new NS Plugin, and a 2.9 VM is also forthcoming.

For the few that do their own compiles and want a fix right away:

The three uses of internalSocketCreate

become 

error = internalSocketCreate(...);
if (error != noErr) {
    interpreterProxy->success(false);
    return;   
}


and the  following routine was rewritten:

static EPInfo* getOrMakeMeAnEP(UInt8 aSocketType,short counter) {
    EPInfo      *epi;
    OTLink        *link;
    SInt32      i;
    
    Recycle();  //Ensure broken EP get fixed up
    
    if (counter > 25)
        return nil;  // End recursion John 2000/8/29

    if (gIdleEPCounter[aSocketType] < 5)   //Magic Number ensure we have at
least 5 EP available.
        makeMeAnEP(aSocketType);
        
    link = OTLIFODequeue(gIdleEPs[aSocketType]);
    if (link == NULL) {
        for(i=0;i<10;i++) {OTIdle();};
        return getOrMakeMeAnEP(aSocketType,counter+1); //Watch for recursive
failure
    }
    
       OTAtomicAdd32(-1, &gIdleEPCounter[aSocketType]);
    epi = OTGetLinkObject(link, EPInfo, link);
    
    if (OTAtomicTestBit(&epi->stateFlags3, kSleepKilledMe)) {
    //
    //A broken epi on the idle stack, now the only way we can
    //get here (I think) is to have gone to sleep which breaks
    //all the end points. To clean up we must now fix them
    //So make it idle, of course it's broken
    //Then recursive call to get another one
    //This continues until we get a good one
    //
          makeEPIdle(epi);
        return getOrMakeMeAnEP(aSocketType,counter);  //Not a recursion
issue. 
    }
    return epi;
}




--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================
Custom Macintosh programming & various Smalltalk dialects
PGP Key: DSS/Diff/46FC3BE6
Fingerprint=B22F 7D67 92B7 5D52 72D7  E94A EE69 2D21 46FC 3BE6
===========================================================================





More information about the Squeak-dev mailing list