2018-01-03 Fred Gleason <fredg@paravelsystems.com>

* Fixed races in creation of new carts.
This commit is contained in:
Fred Gleason
2018-01-03 15:36:45 -05:00
parent d60b138629
commit c63ae45991
30 changed files with 238 additions and 145 deletions

View File

@@ -43,6 +43,7 @@ void Xport::AddCart()
QString type;
RDCart::Type cart_type=RDCart::All;
int cart_number=0;
QString err_msg;
//
// Verify Post
@@ -96,9 +97,9 @@ void Xport::AddCart()
delete cart;
XmlExit("Cart already exists",400,"carts.cpp",LINE_NUMBER);
}
if(!cart->create(group_name,cart_type)) {
if(RDCart::create(group_name,cart_type,&err_msg,cart_number)==0) {
delete cart;
XmlExit("Unable to create cart",500,"carts.cpp",LINE_NUMBER);
XmlExit("Unable to create cart ["+err_msg+"]",500,"carts.cpp",LINE_NUMBER);
}
printf("Content-type: application/xml\n");
printf("Status: 200\n\n");

View File

@@ -41,6 +41,7 @@ void Xport::Import()
unsigned msecs=0;
int resp_code=0;
QString remote_host;
QString err_msg;
if(getenv("REMOTE_HOST")==NULL) {
if(getenv("REMOTE_ADDR")==NULL) {
@@ -147,7 +148,11 @@ void Xport::Import()
XmlExit("No available carts for specified group",404,"import.cpp",LINE_NUMBER);
}
cart=new RDCart(cartnum);
cart->create(group_name,RDCart::Audio);
if(RDCart::create(group_name,RDCart::Audio,&err_msg,cartnum)==0) {
delete cart;
XmlExit("Unable to create cart ["+err_msg+"]",500,"import.cpp",
LINE_NUMBER);
}
cutnum=1;
cut=new RDCut(cartnum,cutnum,true);
delete group;