Changeset 698 for trunk


Ignore:
Timestamp:
May 4, 2007 12:13:55 PM (17 years ago)
Author:
nkissebe
Message:

add requests (pixel count) update for nanoscale compatability
additional error handling on process exits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/vizservers/pymolproxy/pymolproxy.c

    r696 r698  
    968968{
    969969        char buffer[800];
    970         int bytes=0;
     970        unsigned int bytes=0;
     971        float samples = 0.0;
    971972        struct pymol_proxy *pymol = (struct pymol_proxy *) cdata;
    972973
     
    987988        waitForString(pymol, "image follows: ", buffer, 800);
    988989
    989         sscanf(buffer, "image follows: %d\n", &bytes);
    990 
     990        sscanf(buffer, "image follows: %d %f\n", &bytes, &samples);
     991 
     992        write(3,&samples,sizeof(samples));
     993 
    991994    dyBufferSetLength(&pymol->image, bytes);
    992995
     
    10101013{
    10111014        char buffer[800];
    1012         int bytes=0;
     1015        unsigned int bytes=0;
     1016        float samples = 0.0;
    10131017        struct pymol_proxy *pymol = (struct pymol_proxy *) cdata;
    10141018
     
    10291033        waitForString(pymol, "image follows: ", buffer, 800);
    10301034
    1031         sscanf(buffer, "image follows: %d\n", &bytes);
     1035        sscanf(buffer, "image follows: %d %f\n", &bytes, &samples);
     1036        write(3,&samples,sizeof(samples));
    10321037
    10331038    dyBufferSetLength(&pymol->image, bytes);
     
    10481053int pyMol_Proxy(int c_in, int c_out, char *command, char *argv[])
    10491054{
    1050     int flags;
    1051         int status;
    1052         int eof;
     1055    int flags, status, result = 0;
    10531056        int pairIn[2];
    10541057        int pairOut[2];
     
    12981301    }
    12991302
    1300         status = waitpid(pid, NULL, WNOHANG);
     1303        status = waitpid(pid, &result, WNOHANG);
    13011304
    13021305        if (status == -1)
     
    13061309                kill(-pid, SIGTERM); // kill process group
    13071310                alarm(5);
    1308                 status = waitpid(pid, NULL, 0);
     1311                status = waitpid(pid, &result, 0);
    13091312                alarm(0);
    13101313
     
    13141317                        kill(-pid, SIGKILL); // kill process group
    13151318                        alarm(10);
    1316                         status = waitpid(pid, NULL, 0);
     1319                        status = waitpid(pid, &result, 0);
    13171320                        alarm(0);
    13181321                }
    13191322        }
    13201323
    1321         fprintf(stderr, "pymolproxy: pymol server process ended\n");
     1324        fprintf(stderr, "pymolproxy: pymol server process ended (%d)\n", result);
    13221325
    13231326        dyBufferFree(&pymol.image);
Note: See TracChangeset for help on using the changeset viewer.