![[ios2]ASIHTTPReques 清除所有持久连接 [ios2]ASIHTTPReques 清除所有持久连接](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
http://www.winddisk.com/2012/08/27/iphone_screenlock_network_disconnection/
+ (void)clearPersistentConnections
{
[connectionsLock lock];
NSUInteger i;
for (i=0; i<[persistentConnectionsPool count]; i++) {
NSDictionary *existingConnection = [persistentConnectionsPool objectAtIndex:i];
if (![existingConnection objectForKey:@"request"]) {
#if DEBUG_PERSISTENT_CONNECTIONS
ASI_DEBUG_LOG(@"[CONNECTION] Closing connection #%i manualy",[[existingConnection objectForKey:@"id"] intValue]);
#endif
NSInputStream *stream = [existingConnection objectForKey:@"stream"];
if (stream) {
[stream close];
}
[persistentConnectionsPool removeObject:existingConnection];
i--;
}
}
[connectionsLock unlock];
}