- Timestamp:
- Aug 26, 2011, 11:06:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/pymolproxy/pymolproxy.c
r2407 r2419 107 107 108 108 typedef struct Image { 109 struct Image *nextPtr; /* Next image in chain of images. The list is 110 * ordered by the most recently received image 111 * from the pymol server to the least. */ 112 struct Image *prevPtr; /* Previous image in chain of images. The list 113 * is ordered by the most recently received 114 * image from the pymol server to the 115 * least. */ 116 ssize_t nWritten; /* Number of bytes of image data already 117 * delivered.*/ 118 size_t bytesLeft; /* Number of bytes of image data left to 119 * delivered to the client. */ 120 char data[1]; /* Start of image data. We allocate the size 121 * of the Image structure plus the size of the 122 * image data. */ 109 struct Image *nextPtr; /* Next image in chain of images. The 110 * list is ordered by the most 111 * recently received image from the 112 * pymol server to the least. */ 113 struct Image *prevPtr; /* Previous image in chain of 114 * images. The list is ordered by the 115 * most recently received image from 116 * the pymol server to the least. */ 117 ssize_t nWritten; /* Number of bytes of image data 118 * already delivered.*/ 119 size_t bytesLeft; /* Number of bytes of image data left 120 * to delivered to the client. */ 121 char data[1]; /* Start of image data. We allocate 122 * the size of the Image structure 123 * plus the size of the image data. */ 123 124 } Image; 124 125 … … 2075 2076 close(proxy.sin); 2076 2077 2077 status = waitpid(child, &result, WNOHANG); 2078 if (status == -1) { 2078 if (waitpid(child, &result, 0) < 0) { 2079 2079 ERROR("error waiting on pymol server to exit: %s", strerror(errno)); 2080 } else if (status == 0) { 2081 ERROR("attempting to signal (SIGTERM) pymol server."); 2082 kill(-child, SIGTERM); // Kill process group 2083 alarm(5); 2084 status = waitpid(child, &result, 0); 2085 alarm(0); 2086 2087 while ((status == -1) && (errno == EINTR)) { 2088 ERROR("Attempting to signal (SIGKILL) pymol server."); 2089 kill(-child, SIGKILL); // Kill process group 2090 alarm(10); 2091 status = waitpid(child, &result, 0); 2092 alarm(0); 2093 } 2094 } 2080 } 2081 INFO("attempting to signal (SIGTERM) pymol server."); 2082 kill(-child, SIGTERM); // Kill process group 2083 alarm(5); 2095 2084 2096 ERROR("pymol server process ended (result=%d)", result); 2085 if (waitpid(child, &result, 0) < 0) { 2086 ERROR("error waiting on pymol server to exit after SIGTERM: %s", 2087 strerror(errno)); 2088 } 2089 status = -1; 2090 while ((status == -1) && (errno == EINTR)) { 2091 ERROR("Attempting to signal (SIGKILL) pymol server."); 2092 kill(-child, SIGKILL); // Kill process group 2093 alarm(10); 2094 status = waitpid(child, &result, 0); 2095 alarm(0); 2096 } 2097 INFO("pymol server process ended (result=%d)", result); 2098 2097 2099 DestroyTmpDir(); 2098 2099 2100 Tcl_DeleteInterp(interp); 2100 2101 … … 2117 2118 fcntl(proxyPtr->cin, F_SETFL, flags|O_NONBLOCK); 2118 2119 2119 pollResults[0].fd = proxyPtr->cout; 2120 pollResults[1].fd = proxyPtr->sout; 2121 pollResults[2].fd = proxyPtr->serr; 2120 /* Read file descriptors. */ 2121 pollResults[0].fd = proxyPtr->cout; /* Client standard output */ 2122 pollResults[1].fd = proxyPtr->sout; /* Server standard error. */ 2123 pollResults[2].fd = proxyPtr->serr; /* Server standard error. */ 2122 2124 pollResults[0].events = pollResults[1].events = 2123 2125 pollResults[2].events = POLLIN; 2124 2126 2125 pollResults[3].fd = proxyPtr->cin; 2127 /* Write file descriptors. */ 2128 pollResults[3].fd = proxyPtr->cin; /* Client standard input. */ 2126 2129 pollResults[3].events = POLLOUT; 2127 2130 … … 2163 2166 } else { 2164 2167 ERROR("Failed reading pymol stdout (nBytes=%d)\n", nBytes); 2165 goto error; /* Get out on EOF or error. */2168 goto error; /* Get out on EOF or error. */ 2166 2169 } 2167 2170 } … … 2180 2183 if (errno != EINTR) { 2181 2184 ERROR("lost connection (stderr) to pymol server."); 2182 return;2185 goto error; 2183 2186 } 2184 2187 }
Note: See TracChangeset
for help on using the changeset viewer.