I have really strange problem with SSL async connection. Everything works perfectly when reading data is small and could be received in one package. For this operation I use these methods:
[_asyncSocket writeData:data withTimeout:-1 tag:0];
[sock readDataToData:[GCDAsyncSocket LFData] withTimeout:-1 tag:0];
However when coming data has to be split on some parts ("didReadPartialDataOfLength" is invoked). Method didReadData is never called by first time, I have to invoke once again same request then in results I receive twice same response in didReadData. It's really wierd problem. Anybody have any idea what's wrong.
Sometimes happen that I writeData with some tag (for example 1) and in didReadData I receive tag that I used before that request (for example 0).
Only after the second call the same method receives a valid tag.
Everything happens only for bigger parts of data.
I will check this once again, but I use same dispatch_queue for all operations. Ofc same for initialization socket and calling write methods
Yes, all of methods are calling from same async queue (ofc I can not ensure that it's working on the same thread, but only on same queue).
For huge amount of data after invoke "writeData", 2-3 times calling is "didReadPartialDataOfLength" and all of events are stopped. Than I have to send once again write method, to receive twice "readData" with full response.
It happens also on main thread queue but only for huge amount of data when "didReadPartialDataOfLength" is invoked.