[ENH] Socket Test Suite.

Lex Spoon lex at cc.gatech.edu
Wed Jul 5 19:03:15 UTC 2000


John M McIntosh <johnmci at smalltalkconsulting.com> wrote:
> I have run some tests on Linux, there are some interesting behavior issues
> between that implementation and the macintosh implementation, on socket
> close for example and difference of opinion on address information for UDP
> sockets after setpeer:  My intent in building this suite is to clear up
> differences of opinion between platform implementations of the Socket
> support code.


The socket-closing code on Unix is wrong.  The "close" command invokes
Unix's close(2), which is incorrect.  Squeak's close command actually
mean shutdown for sending, while close(2) is more like Squeak's
"destroy".  Squeak's "close" should really invoke Unix's shutdown() with
an appropriate argument.

I've fixed this once or twice, but I never got anyone to use it because
I never successfully verified a misbehavior from it, and nobody wants to
introduce bugs just to do something the Right Way.  In theory, the
problem is that some data you have sent might not be successfully
received, because you've aborted the connection.

Anyway, the fix is simple, though error prone: modify the SocketClose
implementation to call shutdown() instead of close(), add a new state
for "thisEndClosed" to the Unix implementation, and then patch up all
the other socket routines to be able to handle this new state.  (For
example, reading should be allowed when a socket is in state
thisEndClosed....)


-Lex





More information about the Squeak-dev mailing list