Why 'primitiveShutdownNetwork absent?

John.Maloney at disney.com John.Maloney at disney.com
Tue Oct 26 23:14:08 UTC 1999


Ohshima:

Re:
>  I'm about to finish writing the network support code for a
>PDA.  I was a bit surprised When I found there is no
>primitive assigned for terminating the network session.
>
>  Is it OK to assign primitive 226 for
>'primitiveShutdownNetwork' and implement it in the similar
>way to primitiveInitializeNetwork?

There's no strong reason not have a "shutdownNetwork"
primitive, but I believe that:

  a. It's not entirely clear when you'd want to use this primitive,
     since some other Squeak process might still be using the
     network. In contrast, primitiveInitializeNetwork is
     implemented in a way that it does nothing if the network has
     already been initialized, so every piece of code that uses
     the network can safely begin by calling primitiveInitializeNetwork.

  b. The VM itself must be sure to clean up any network resources
     when the user quits or even if the VM crashes. The Mac version
     of Squeak patches the application exit code to ensure that this
     cleanup happens. If you don't do this on the Mac, you can
     have interrupt code that tries to call a completion routine
     that's no longer there, an almost certain way to crash the
     Mac. (In more sensible OS's with memory protection, of course,
     this wouldn't happen.)

If there's a real need for a shutdownNetwork primitive, I'd
be happy to include it and just have it be a noop on the Mac.
But is it really needed?


Re:
>  I wonder how people shutdown the PPP session.  They just
>do it by using the host OS' function, or they just don't do
>that because they use fixed charge telephone?

On the Mac (and, I think, the PC), you use the host OS
facitility to both initiate and terminate a PPP connection.
Squeak doesn't have any direct control over it, although
if you've configured your machine to dial up a PPP connection
when someone tries to use the network, then Squeak can
indirectly cause a PPP connection to become established
by accessing the network. There's even a Squeak level method
named something like "ensureNetworkConnected" that does a
domain name server lookup of some bogus name to force a
network connection to become established.

	-- John





More information about the Squeak-dev mailing list