mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-21 20:51:52 +00:00
Generate end of stream events immediately on reading eof
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24882 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
33d157dffe
commit
7dcbcdd921
3 changed files with 26 additions and 7 deletions
|
@ -321,9 +321,15 @@ static void setNonblocking(int fd)
|
|||
|
||||
readLen = read((intptr_t)_loopID, buffer, len);
|
||||
if (readLen < 0 && errno != EAGAIN && errno != EINTR)
|
||||
[self _recordError];
|
||||
{
|
||||
[self _recordError];
|
||||
readLen = -1;
|
||||
}
|
||||
else if (readLen == 0)
|
||||
[self _setStatus: NSStreamStatusAtEnd];
|
||||
{
|
||||
[self _setStatus: NSStreamStatusAtEnd];
|
||||
[self _sendEvent: NSStreamEventEndEncountered];
|
||||
}
|
||||
return readLen;
|
||||
}
|
||||
|
||||
|
@ -518,9 +524,15 @@ static void setNonblocking(int fd)
|
|||
|
||||
readLen = read((intptr_t)_loopID, buffer, len);
|
||||
if (readLen < 0 && errno != EAGAIN && errno != EINTR)
|
||||
[self _recordError];
|
||||
{
|
||||
[self _recordError];
|
||||
readLen = -1;
|
||||
}
|
||||
else if (readLen == 0)
|
||||
[self _setStatus: NSStreamStatusAtEnd];
|
||||
{
|
||||
[self _setStatus: NSStreamStatusAtEnd];
|
||||
[self _sendEvent: NSStreamEventEndEncountered];
|
||||
}
|
||||
return readLen;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue