Ignore:
Timestamp:
Nov 24, 2017, 1:18:04 PM (7 years ago)
Author:
djay
Message:

Use nanosleep between successive call of curl_multi_perform.

Location:
branches/prototype-v0/zoo-project/zoo-kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/server_internal.c

    r854 r858  
    11091109    removeService(conf,pid);
    11101110#endif
    1111     /*
     1111    /* No need to call 7_1 when an execution is dismissed.
    11121112      fprintf(stderr,"************************* %s %d \n\n",__FILE__,__LINE__);
    11131113      invokeCallback(conf,NULL,NULL,7,1);
  • branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c

    r854 r858  
    245245    char *curs=strtok(hosts,",");
    246246    while(curs!=NULL){
    247       fprintf(stderr,"### %s %d %s \n",__FILE__,__LINE__,strstr(url,curs));
    248       fflush(stderr);
    249247      if(strstr(url,curs)==NULL)
    250248        res="OTHER";
    251249      else{
    252250        res="SHARED";
    253         fprintf(stderr,"### %s %d %s \n",__FILE__,__LINE__,"SHARED");
    254         fflush(stderr);
    255251        return res;
    256252      }
     
    295291  char* host;
    296292  while(token!=NULL && cnt<=1){
    297     fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,token);
    298     if(cnt==1)
    299       fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,strstr(protectedHosts,token));
    300     fflush(stderr);
    301293    if(cnt==1 && strstr(protectedHosts,token)!=NULL){
    302       fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,strstr(protectedHosts,token));
    303294      return 1;
    304295    }
     
    343334            tmp1[5+j+1]='\0';
    344335          }
    345           fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,tmp1);
    346           //dumpMaps(conf);
    347336          tmpMap = getMapFromMaps(conf,"renv",tmp1);
    348337          if(tmpMap!=NULL){
    349             fprintf(stderr,"add header %s %s\n",token,tmpMap->value);
    350             fflush(stderr);
    351338            AddMissingHeaderEntry(&handle->ihandle[i],token,tmpMap->value);
    352339          }
     
    430417  struct MemoryStruct header;
    431418
    432   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    433   fflush(stderr);
    434419  hInternet->ihandle[hInternet->nb].handle=curl_easy_init( );
    435   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    436   fflush(stderr);
    437420  hInternet->ihandle[hInternet->nb].hasCacheFile=0;
    438   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    439   fflush(stderr);
    440421  hInternet->ihandle[hInternet->nb].nDataAlloc = 0;
    441   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    442   fflush(stderr);
    443422  hInternet->ihandle[hInternet->nb].url = NULL;
    444   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    445   fflush(stderr);
    446423  hInternet->ihandle[hInternet->nb].mimeType = NULL;
    447   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    448   fflush(stderr);
    449424  hInternet->ihandle[hInternet->nb].cookie = NULL;
    450   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    451   fflush(stderr);
    452425  hInternet->ihandle[hInternet->nb].nDataLen = 0;
    453   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    454   fflush(stderr);
    455426  hInternet->ihandle[hInternet->nb].id = hInternet->nb;
    456   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    457   fflush(stderr);
    458427  hInternet->ihandle[hInternet->nb].nDataAlloc = 0;
    459   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    460   fflush(stderr);
    461428  hInternet->ihandle[hInternet->nb].pabyData = NULL;
    462   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    463   fflush(stderr);
    464429  hInternet->ihandle[hInternet->nb].post = NULL;
    465   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    466   fflush(stderr);
    467430 
    468431  curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle, CURLOPT_COOKIEFILE, "ALL");
    469   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    470   fflush(stderr);
    471432#ifndef TIGER
    472433  curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle, CURLOPT_COOKIELIST, "ALL");
    473434#endif
    474435  curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle, CURLOPT_USERAGENT, hInternet->agent);
    475   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    476   fflush(stderr);
    477436 
    478437  curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_FOLLOWLOCATION,1);
    479   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    480   fflush(stderr);
    481438  curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_MAXREDIRS,3);
    482   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    483   fflush(stderr);
    484439 
    485440  header.memory=NULL;
     
    487442
    488443  curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle, CURLOPT_HEADERFUNCTION, header_write_data);
    489   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    490   fflush(stderr);
    491444  curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle, CURLOPT_WRITEHEADER, (void *)&header);
    492   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    493   fflush(stderr);
    494445
    495446#ifdef MSG_LAF_VERBOSE
     
    520471      break;
    521472    }
    522   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    523   fflush(stderr);
    524473#ifdef ULINET_DEBUG
    525474  fprintf(stderr,"URL (%s)\nBODY (%s)\n",lpszUrl,lpszHeaders);
     
    539488    curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_POSTFIELDSIZE,(long)dwHeadersLength);
    540489  }
    541   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    542   fflush(stderr);
    543490  if(hInternet->ihandle[hInternet->nb].header!=NULL)
    544491    curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_HTTPHEADER,hInternet->ihandle[hInternet->nb].header);
    545492
    546   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    547   fflush(stderr);
    548493  curl_easy_setopt(hInternet->ihandle[hInternet->nb].handle,CURLOPT_URL,lpszUrl);
    549494  hInternet->ihandle[hInternet->nb].url = zStrdup(lpszUrl);
    550   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    551   fflush(stderr);
    552495
    553496  curl_multi_add_handle(hInternet->handle,hInternet->ihandle[hInternet->nb].handle);
    554   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    555   fflush(stderr);
    556497 
    557498  hInternet->ihandle[hInternet->nb].header=NULL;
    558   fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    559   fflush(stderr);
    560499  ++hInternet->nb;
    561500  hInternet->ihandle[hInternet->nb].header=NULL;
     
    579518  int i=0;
    580519  do{
    581     curl_multi_perform(hInternet->handle, &still_running);
     520    if(curl_multi_perform(hInternet->handle, &still_running)==CURLM_OK)
     521      if(still_running){
     522        struct timespec tv;
     523        tv.tv_sec = 0;
     524        tv.tv_nsec = (long) 5*1e+9;
     525        nanosleep(&tv, &tv);
     526      }
    582527  }while(still_running); 
    583528  for(i=0;i<hInternet->nb;i++){
    584529    char *tmp;
    585     fprintf(stderr," *** %s %d %d \n",__FILE__,__LINE__,i);
    586530    curl_easy_getinfo(hInternet->ihandle[i].handle,CURLINFO_CONTENT_TYPE,&tmp);
    587     fprintf(stderr," *** %s %d %d \n",__FILE__,__LINE__,i);
    588531    if(tmp!=NULL)
    589532      hInternet->ihandle[i].mimeType=strdup(tmp);
    590     fprintf(stderr," *** %s %d %d \n",__FILE__,__LINE__,i);
    591533    curl_easy_getinfo(hInternet->ihandle[i].handle,CURLINFO_RESPONSE_CODE,&hInternet->ihandle[i].code);
    592     fprintf(stderr," *** %s %d %d \n",__FILE__,__LINE__,i);
    593534    curl_multi_remove_handle(hInternet->handle, hInternet->ihandle[i].handle);
    594     fprintf(stderr," *** %s %d %d \n",__FILE__,__LINE__,i);
    595535    curl_easy_cleanup(hInternet->ihandle[i].handle);
    596     fprintf(stderr," *** %s %d %d \n",__FILE__,__LINE__,i);
    597     //fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,hInternet->ihandle[i].mimeType);
    598     //fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,hInternet->ihandle[i].pabyData);
    599536  }
    600537  return 0;
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png