twitter-archive / CocoaSPDY

SPDY for iOS and OS X
Apache License 2.0
2.39k stars 233 forks source link

Allowed uploading files more than 65536 bytes. #85

Open petroakzhygitov opened 9 years ago

petroakzhygitov commented 9 years ago

sendWindowSize was never updated with new stream.windowSize value

kgoodier commented 9 years ago

_sessionSendWindowSize represents the window size the remote side will accept for the session. It needs to be decremented for each send so the sender doesn't overflow the remote's window size. It's expected the remote sends back WINDOW_UPDATE frames with stream-id set to 0 to increase the _sessionSendWindowSize in the sender.

petroakzhygitov commented 9 years ago

Ok. But there is still a problem with uploading files more than 65536 bytes.

There is a function:

if streamId is eqal to kSPDYSessionStreamId then _sessionSendWindowSize should be increased, but if not, stream.sendWindowSize should be increased instead. So only one sendWindowSize will be increased, not the both.

In _sendData:(SPDYStream *)stream function both of sendWindowSize were decreased at the same time: _sessionSendWindowSize -= bytesSent; stream.sendWindowSize -= bytesSent; and in case of bytesSent equals 65536 bytes, they both equal 0.

Upon next call to the _sendData this line will always return 0: uint32_t sendWindowSize = MIN(_sessionSendWindowSize, stream.sendWindowSize);

because only one sendWindowSize was increased in didReadWindowUpdateFrame.

So, a file with size more than 65536 bytes will never send.

petroakzhygitov commented 9 years ago

Could you please, also, update CocoaPods with the latest 1.0.2 version? Now its 1.0.1

CLAassistant commented 5 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


petroakzhygitov seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.