[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] Re: Problems with Socket>>isPeerAlive
From: |
Paolo Bonzini |
Subject: |
Re: [Help-smalltalk] Re: Problems with Socket>>isPeerAlive |
Date: |
Tue, 31 Oct 2006 13:31:04 +0100 |
User-agent: |
Thunderbird 1.5.0.7 (Macintosh/20060909) |
Robin Redeker wrote:
On Tue, Oct 31, 2006 at 12:43:47PM +0100, Robin Redeker wrote:
Hi,
in the attachment there is a piece of code, which establishes a tcp
connection to a listening socket and reads all arriving data from there.
Yes, the SIGIO arrives but events.c misses it because a POLLHUP
condition (peer dead) does not increment the return value of poll.
Fixing this in turn triggers a latent bug in sockets. See the attached
patch, I need to test it a bit more before committing.
Thanks,
Paolo
* looking for address@hidden/smalltalk--devo--2.2--patch-168 to compare with
* comparing to address@hidden/smalltalk--devo--2.2--patch-168
M kernel/PosStream.st
M kernel/Stream.st
M libgst/events.c
M tcp/Sockets.st
* modified files
--- orig/kernel/PosStream.st
+++ mod/kernel/PosStream.st
@@ -245,13 +245,6 @@ collection
^collection
!
-pastEnd
- "The end of the stream has been reached. Signal a Notification"
-
- SystemExceptions.EndOfStream signalOn: self.
- ^nil
-!
-
status: aString
"When working with a stream on strings, this method can be useful!
Format of the output:
--- orig/kernel/Stream.st
+++ mod/kernel/Stream.st
@@ -300,12 +300,19 @@ tab
! !
-!Stream methodsFor: 'providing consistent protocols'!
+!Stream methodsFor: 'polymorphism'!
close
"Do nothing. This is provided for consistency with file streams"
!
+pastEnd
+ "The end of the stream has been reached. Signal a Notification."
+
+ SystemExceptions.EndOfStream signalOn: self.
+ ^nil
+!
+
flush
"Do nothing. This is provided for consistency with file streams"
! !
--- orig/libgst/events.c
+++ mod/libgst/events.c
@@ -190,9 +190,6 @@ file_polling_handler (int sig)
}
while (n == -1 && errno == EINTR);
- if (n == 0)
- return;
-
num_used_pollfds = 0;
for (node = head, pprev = &head; node; node = *pprev)
{
--- orig/tcp/Sockets.st
+++ mod/tcp/Sockets.st
@@ -818,6 +818,7 @@ available
bufferContents
"Answer the current contents of the read buffer"
| result |
+ readBuffer isNil ifTrue: [ ^self pastEnd ].
result := self readBuffer bufferContents.
lookahead isNil ifFalse: [
result := lookahead asString, result.