ios - Infinite loop in connection:didReceiveData in AFURLConnectionOperation.m -


i using afnetworking2 ios project requires extensive image loading.

after downloading number of images, outgoing requests queued in operation queue , never go out.

i found out because in

afurlconnectionoperation.m,(void)connection:didreceivedata

there while(yes) loop , breaks when

[self.outputstream hasspaceavailable]

or when

self.outputstream.streamerror

occurs.

but, in case, [self.outputstream hasspaceavailable] returns no, , operation remains stuck in while (yes) loop.

has experienced issue, , solution?

here code of

afurlconnectionoperation.m,(void)connection:didreceivedata

for context:

- (void)connection:(nsurlconnection __unused *)connection     didreceivedata:(nsdata *)data {     nsuinteger length = [data length];     while (yes) {          ...         if ([self.outputstream hasspaceavailable]) {             ...             break;         }         if (self.outputstream.streamerror) {             ....             return;         }     }     ... } 

note: overriding function code below overcome issue.

- (void)connection:(nsurlconnection __unused *)connection     didreceivedata:(nsdata *)data {     nsuinteger length = [data length];     if ([self.outputstream hasspaceavailable]) {         const uint8_t *databuffer = (uint8_t *) [data bytes];         [self.outputstream write:&databuffer[0] maxlength:length];     } } 

it seems bug in afnetworking. see here.

there committed fix mentioned in issue, doesn't seem available in latest version reason (2.5.4).


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -