Ignore:
Timestamp:
Mar 21, 2019, 4:14:14 PM (3 years ago)
Author:
djay
Message:

Add information abouut semaphore status for future deletion. Make sure to store on disk inputs passed by reference in case no specific memory=load has been set in the [main] section. Fix ticket #170. Add support for publishing raster applying a style definition found in the metadata (zcfg or database).

File:
1 edited

Legend:

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

    r890 r897  
    33 * Author : Gérald FENOY
    44 *
    5  * Copyright 2017 GeoLabs SARL. All rights reserved.
     5 * Copyright 2017-2019 GeoLabs SARL. All rights reserved.
    66 *
    77 * This work was supported by public funds received in the framework of GEOSUD,
     
    322322 */
    323323bool ssh_copy(maps* conf,const char* localPath,const char* targetPath,int cnt){
    324   char mem[1024 * 1000];
     324  char mem[1024 * 16];
    325325  size_t nread;
    326326  size_t memuse=0;
    327327  time_t start;
    328328  long total = 0;
     329  int counter=0;
    329330  int duration;
    330331  int rc;
     
    391392      break;
    392393   
    393     if(memuse - rc) {
    394       memmove(&mem[0], &mem[rc], memuse - rc);
    395       memuse -= rc;
    396     }
    397     else
    398       memuse = 0;
     394    memuse = 0;
    399395   
    400396  } while (rc > 0);
     
    438434    }
    439435    if(!sessions[cnt]->sftp_session)
    440       zSleep(1);
     436      zSleep(10);
    441437  } while (!sessions[cnt]->sftp_session);
    442438  do {
     
    453449    }
    454450    if(!sftp_handle)
    455       zSleep(1);
     451      zSleep(10);
    456452  } while (!sftp_handle);
    457  
     453
    458454  int result=0;
     455  int counter=0;
    459456  do {
    460457    do {
    461       char* mem=(char*)malloc(16*1024*1024);
    462       rc = libssh2_sftp_read(sftp_handle, mem,16*1024*1024);
     458      char* mem=(char*)malloc(16*1024);
     459      rc = libssh2_sftp_read(sftp_handle, mem,16*1024);
    463460      if(rc > 0) {
    464461        fwrite(mem, rc, 1, local);
    465462      }
    466463      free(mem);
     464      if(counter%25==0)
     465        zSleep(10);
    467466    } while (rc > 0);
    468    
     467
    469468    if(rc != LIBSSH2_ERROR_EAGAIN) {
    470469      result=-1;
    471470      break;
    472471    }
    473    
     472
    474473    struct timeval timeout;
    475474    fd_set fd;
    476475    timeout.tv_sec = 10;
    477476    timeout.tv_usec = 0;
    478  
     477
    479478    FD_ZERO(&fd);
    480  
     479
    481480    FD_SET(sessions[cnt]->sock_id, &fd);
    482  
     481
    483482    rc = select(sessions[cnt]->sock_id+1, &fd, &fd, NULL, &timeout);
    484483    if(rc <= 0) {
     
    489488      return -1;
    490489    }
    491    
     490
     491    if(counter%50==0)
     492       zSleep(10);
     493    counter++;
     494
    492495  } while (1);
    493496  duration = (int)(time(NULL)-start);
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