mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 16:20:42 +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
6382c48c0f
commit
00cec80391
2 changed files with 18 additions and 3 deletions
|
@ -75,7 +75,7 @@
|
||||||
{ \
|
{ \
|
||||||
id _delegate; /* Delegate controls operation. */\
|
id _delegate; /* Delegate controls operation. */\
|
||||||
NSMutableDictionary *_properties; /* storage for properties */\
|
NSMutableDictionary *_properties; /* storage for properties */\
|
||||||
BOOL _delegateValid;/* whether the delegate responds*/\
|
BOOL _delegateValid; /* whether the delegate responds*/\
|
||||||
NSError *_lastError; /* last error occured */\
|
NSError *_lastError; /* last error occured */\
|
||||||
NSStreamStatus _currentStatus;/* current status */\
|
NSStreamStatus _currentStatus;/* current status */\
|
||||||
NSMapTable *_loops; /* Run loops and their modes. */\
|
NSMapTable *_loops; /* Run loops and their modes. */\
|
||||||
|
|
|
@ -407,7 +407,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
||||||
{
|
{
|
||||||
NSDebugMLLog(@"NSStream", @"record error: %@ - %@", self, anError);
|
NSDebugMLLog(@"NSStream", @"record error: %@ - %@", self, anError);
|
||||||
ASSIGN(_lastError, anError);
|
ASSIGN(_lastError, anError);
|
||||||
_currentStatus = NSStreamStatusError;
|
[self _setStatus: NSStreamStatusError];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _resetEvents: (NSUInteger)mask
|
- (void) _resetEvents: (NSUInteger)mask
|
||||||
|
@ -533,7 +533,22 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
||||||
|
|
||||||
- (void) _setStatus: (NSStreamStatus)newStatus
|
- (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
|
- (BOOL) _unhandledData
|
||||||
|
|
Loading…
Reference in a new issue