huiping192 / HPRTMP

HPRTMP is a Swift library for RTMP streaming, with an easy-to-use API, efficient message handling, and robust error recovery.
MIT License
16 stars 3 forks source link

Fix race condition of dataPromise and responseReceived(fix #16) #17

Open karino2 opened 1 month ago

karino2 commented 1 month ago

This is the cause of "window size reached" bug. If responseReceived thread is suspended when dataPromise.succeed call, and another thread which waked up by dataPromisss.succeed call reciveData again, that second call create dataPromise promise. Then resume responseRecived thread clear dataPromise property without calling succeed, which cause forever waiting.

In this fix, dataPromise and cachedRecivedData is isolated by actor and access only from the same actor context.