@@ -13,10 +13,12 @@ * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" + +#include #import "OFRunLoop.h" #import "OFDictionary.h" #import "OFThread.h" #import "OFSortedList.h" @@ -258,10 +260,26 @@ }) } #endif #undef ADD + ++ (void)OF_cancelAsyncRequestsForStream: (OFStream*)stream +{ + void *pool = objc_autoreleasePoolPush(); + OFRunLoop *runLoop = [self currentRunLoop]; + OFList *queue; + + if ((queue = [runLoop->readQueues objectForKey: stream]) != nil) { + assert([queue count] > 0); + + [runLoop->streamObserver removeStreamForReading: stream]; + [runLoop->readQueues removeObjectForKey: stream]; + } + + objc_autoreleasePoolPop(pool); +} - init { self = [super init];