[BUG] waitForData and half-closed connections

Lex Spoon lex at cc.gatech.edu
Tue Sep 16 16:07:37 UTC 2003


There is an ancient bug in the method
waitForDataFor:ifClosed:ifTimedOut:.  The offending statement is this
one:

	self isConnected
		ifFalse: [^closedBlock value].

isConnected only returns true if the socket is fully connected. 
However, surely you should be able to wait-for-data if the socket is
half-open for receiving data?

In that case -- which seems correct -- the test should be
isOtherEndConnected.  Or at least, I think it should be.  I get mixed up
about this, but it seems like "closing" is a promise not to send any
more data.  Thus, if you are waiting for data, you want to know that the
other side has not closed the connection.

However, #flush seems to make the opposite assumption: if you want to
send data, then you need isOtherEndConnected.  It seems to me that you
want isThisEndConnected.

Or maybe half-closed connections just aren't modeled.  But surely they
should be.....

The other waitForData and waitForSendDone variants have the same bug.

-Lex



More information about the Squeak-dev mailing list