Changeset 652 for trunk/zoo-project/zoo-kernel/response_print.c
- Timestamp:
- Jun 11, 2015, 3:07:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/response_print.c
r651 r652 1515 1515 int lpid; 1516 1516 map* tmpm2=getMapFromMaps(m,"lenv","usid"); 1517 lpid=atoi(tmpm2->value); 1518 tmpm2=getMap(tmp_maps->content,"tmpUrl"); 1519 if(tmpm1!=NULL && tmpm2!=NULL){ 1520 if( strncasecmp( tmpm2->value, "http://", 7) == 0 || 1521 strncasecmp( tmpm2->value, "https://", 8 ) == 0 ){ 1522 sprintf(url,"%s/%s_%i.xml",tmpm2->value,service,lpid); 1517 map* tmpm3=getMap(tmp_maps->content,"tmpUrl"); 1518 if(tmpm1!=NULL && tmpm3!=NULL){ 1519 if( strncasecmp( tmpm3->value, "http://", 7) == 0 || 1520 strncasecmp( tmpm3->value, "https://", 8 ) == 0 ){ 1521 sprintf(url,"%s/%s_%s.xml",tmpm3->value,service,tmpm2->value); 1523 1522 }else 1524 sprintf(url,"%s/%s /%s_%i.xml",tmpm1->value,tmpm2->value,service,lpid);1523 sprintf(url,"%s/%s_%s.xml",tmpm1->value,service,tmpm2->value); 1525 1524 } 1526 1525 } … … 1529 1528 } 1530 1529 int lpid; 1531 tmpm1=getMapFromMaps(m,"lenv","usid"); 1532 lpid=atoi(tmpm1->value); 1530 map* tmpm2=getMapFromMaps(m,"lenv","usid"); 1533 1531 tmpm1=getMapFromMaps(m,"main","TmpPath"); 1534 sprintf(stored_path,"%s/%s_% i.xml",tmpm1->value,service,lpid);1532 sprintf(stored_path,"%s/%s_%s.xml",tmpm1->value,service,tmpm2->value); 1535 1533 } 1536 1534 … … 1683 1681 } 1684 1682 1685 if(hasStoredExecuteResponse==true && status!=SERVICE_STARTED){ 1686 semid lid=getShmLockId(m,1); 1683 if(hasStoredExecuteResponse==true && status!=SERVICE_STARTED && status!=SERVICE_ACCEPTED){ 1684 #ifndef RELY_ON_DB 1685 semid lid=acquireLock(m);//,1); 1687 1686 if(lid<0){ 1688 1687 /* If the lock failed */ … … 1694 1693 } 1695 1694 else{ 1696 #ifdef DEBUG1697 fprintf(stderr,"LOCK %s %d !\n",__FILE__,__LINE__);1698 1695 #endif 1699 lockShm(lid);1700 1696 /* We need to write the ExecuteResponse Document somewhere */ 1701 1697 FILE* output=fopen(stored_path,"w"); … … 1709 1705 xmlCleanupParser(); 1710 1706 zooXmlCleanupNs(); 1707 #ifndef RELY_ON_DB 1711 1708 unlockShm(lid); 1709 #endif 1712 1710 return; 1713 1711 } … … 1718 1716 xmlFree(xmlbuff); 1719 1717 fclose(output); 1718 #ifndef RELY_ON_DB 1720 1719 #ifdef DEBUG 1721 1720 fprintf(stderr,"UNLOCK %s %d !\n",__FILE__,__LINE__); 1722 1721 #endif 1723 1722 unlockShm(lid); 1724 map* test1=getMap(request,"status"); 1725 if(test1==NULL || strcasecmp(test1->value,"true")!=0){ 1726 removeShmLock(m,1); 1727 } 1728 } 1723 map* v=getMapFromMaps(m,"lenv","sid"); 1724 // Remove the lock when running as a normal task 1725 if(getpid()==atoi(v->value)){ 1726 removeShmLock (m, 1); 1727 } 1728 } 1729 #endif 1729 1730 } 1730 1731 printDocument(m,doc,pid); … … 2316 2317 #endif 2317 2318 maps* tmpI=request_outputs; 2318 2319 map* usid=getMapFromMaps(m,"lenv","usid"); 2320 int itn=0; 2319 2321 while(tmpI!=NULL){ 2320 2322 #ifdef USE_MS … … 2354 2356 } 2355 2357 2356 if(gfile==NULL) {2358 if(gfile==NULL) { 2357 2359 map *ext=getMap(tmpI->content,"extension"); 2358 2360 char *file_path; … … 2369 2371 } 2370 2372 2371 file_name=(char*)malloc((strlen(s->name)+strlen( file_ext)+strlen(tmpI->name)+1024)*sizeof(char));2372 int cpid0=cpid+time(NULL);2373 sprintf(file_name,"%s_%s_%i.%s",s->name,tmpI->name,cpid0,file_ext);2373 file_name=(char*)malloc((strlen(s->name)+strlen(usid->value)+strlen(file_ext)+strlen(tmpI->name)+45)*sizeof(char)); 2374 sprintf(file_name,"%s_%s_%s_%d.%s",s->name,tmpI->name,usid->value,itn,file_ext); 2375 itn++; 2374 2376 file_path=(char*)malloc((strlen(tmp1->value)+strlen(file_name)+2)*sizeof(char)); 2375 2377 sprintf(file_path,"%s/%s",tmp1->value,file_name); 2376 2378 2377 2379 FILE *ofile=fopen(file_path,"wb"); 2378 2380 if(ofile==NULL){ 2379 2381 char tmpMsg[1024];
Note: See TracChangeset
for help on using the changeset viewer.