mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Unchedule I/O events when entering an error state
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39875 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4423274d5b
commit
011e3d86ed
2 changed files with 18 additions and 3 deletions
|
@ -75,7 +75,7 @@
|
|||
{ \
|
||||
id _delegate; /* Delegate controls operation. */\
|
||||
NSMutableDictionary *_properties; /* storage for properties */\
|
||||
BOOL _delegateValid;/* whether the delegate responds*/\
|
||||
BOOL _delegateValid; /* whether the delegate responds*/\
|
||||
NSError *_lastError; /* last error occured */\
|
||||
NSStreamStatus _currentStatus;/* current status */\
|
||||
NSMapTable *_loops; /* Run loops and their modes. */\
|
||||
|
|
|
@ -407,7 +407,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
{
|
||||
NSDebugMLLog(@"NSStream", @"record error: %@ - %@", self, anError);
|
||||
ASSIGN(_lastError, anError);
|
||||
_currentStatus = NSStreamStatusError;
|
||||
[self _setStatus: NSStreamStatusError];
|
||||
}
|
||||
|
||||
- (void) _resetEvents: (NSUInteger)mask
|
||||
|
@ -533,7 +533,22 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
|
||||
- (void) _setStatus: (NSStreamStatus)newStatus
|
||||
{
|
||||
_currentStatus = newStatus;
|
||||
if (_currentStatus != newStatus)
|
||||
{
|
||||
if (NSStreamStatusError == newStatus && NSCountMapTable(_loops) > 0)
|
||||
{
|
||||
/* After an error, we are in the run loops only to trigger
|
||||
* errors, not for I/O, sop we must re-schedule in the right mode.
|
||||
*/
|
||||
[self _unschedule];
|
||||
_currentStatus = newStatus;
|
||||
[self _schedule];
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentStatus = newStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) _unhandledData
|
||||
|
|
Loading…
Reference in a new issue