Ignore:
Timestamp:
Aug 29, 2017, 10:52:39 AM (7 years ago)
Author:
djay
Message:

Fix various memory leaks and enhance the callback support. Add the prohibited keyword to the callback section to avoid calling callback for such services.

File:
1 edited

Legend:

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

    r846 r850  
    3535#endif
    3636
     37  /**
     38   * Check if a service name is prohibited, meaning that we don't have to invoke
     39   * the callback for this specific service.
     40   *
     41   */
     42  bool isProhibited(maps* conf,const char* serviceName){
     43    map* plist=getMapFromMaps(conf,"callback","prohibited");
     44    if(plist!=NULL){
     45      char *tmp=plist->value;
     46      char *tmpS=strtok(tmp,",");
     47      while(tmpS!=NULL){
     48        if(strcmp(serviceName,tmpS)==0)
     49          return true;
     50        tmpS=strtok(NULL,",");
     51      }
     52    }
     53    return false;
     54  }
     55 
    3756  /**
    3857   * Invoke the callback in case there is a [callback] section containing a url parameter
     
    5776    if(url==NULL)
    5877      return false;
    59 
     78     
    6079    maps* lenv=getMaps(m,"lenv");
    61 
     80    map* sname=getMap(lenv->content,"identifier");
     81    if(sname!=NULL && isProhibited(m,sname->value))
     82      return false;
     83     
    6284    json_object *res=json_object_new_object();
    6385
     
    87109      maps* curs=inputs;
    88110     
    89       char *keys[4][2]={
     111      char *keys[8][2]={
    90112        {
    91113          "href",
     
    103125          "size",
    104126          "size"
    105         }
     127        },
     128        {
     129          "ref_wms_link",
     130          "ref_wms_link"
     131        },
     132        {
     133          "ref_wcs_link",
     134          "ref_wcs_link"
     135        },
     136        {
     137          "ref_wfs_link",
     138          "ref_wfs_link"
     139        },
     140        {
     141          "datatype",
     142          "datatype"
     143        }       
    106144      };
    107145      json_object *res1=json_object_new_object();
    108146      while(curs!=NULL){
    109147        map* tmpMap=getMap(curs->content,"cache_file");
    110         if(tmpMap!=NULL){
     148        sid=getMap(curs->content,"ref_wms_link");
     149        if(tmpMap!=NULL && sid==NULL){
    111150          addToMap(curs->content,"generated_file",tmpMap->value);
    112151          tmpMap=getMap(curs->content,"fmimeType");
     
    121160        int i=0;
    122161        int hasRef=-1;
    123         for(;i<4;i++){
     162        for(;i<8;i++){
    124163          sid=getMap(curs->content,keys[i][0]);
    125164          if(sid!=NULL){
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