Fix race condition in Livepeer process uploader

This commit is contained in:
Thulinma 2024-07-15 11:45:37 +02:00
parent c466e6e513
commit e20d8fae8c

View file

@ -444,7 +444,6 @@ void uploadThread(void * num){
was422 = false; was422 = false;
prevURL.clear(); prevURL.clear();
mySeg.fullyWritten = false; mySeg.fullyWritten = false;
mySeg.fullyRead = true;
//Wait your turn //Wait your turn
while (myNum != insertTurn && conf.is_active){Util::sleep(100);} while (myNum != insertTurn && conf.is_active){Util::sleep(100);}
if (!conf.is_active){return;}//Exit early on shutdown if (!conf.is_active){return;}//Exit early on shutdown
@ -454,6 +453,7 @@ void uploadThread(void * num){
++statFailParse; ++statFailParse;
FAIL_MSG("Non-multipart response received - this version only works with multipart!"); FAIL_MSG("Non-multipart response received - this version only works with multipart!");
} }
mySeg.fullyRead = true;
insertTurn = (insertTurn + 1) % PRESEG_COUNT; insertTurn = (insertTurn + 1) % PRESEG_COUNT;
break;//Success: no need to retry break;//Success: no need to retry
}else if (upper.getStatusCode() == 422){ }else if (upper.getStatusCode() == 422){