Fossil SCM

Add a new explanatory comment to clarify the operation of the "fossil server" implementation. No code changes.

drh 2019-03-22 18:39 trunk
Commit c546212f10cc660669c4c795036b58221a3620c32450e7d75385e875dec05df5
1 file changed +9
+9
--- src/main.c
+++ src/main.c
@@ -2639,10 +2639,19 @@
26392639
if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
26402640
db_close(1);
26412641
if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
26422642
fossil_fatal("unable to listen on TCP socket %d", iPort);
26432643
}
2644
+ /* For the parent process, the cgi_http_server() command above never
2645
+ ** returns (except in the case of an error). Instead, for each incoming
2646
+ ** client connection, a child process is created, file descriptors 0
2647
+ ** and 1 are bound to that connection, and the child returns.
2648
+ **
2649
+ ** So, when control reaches this point, we are running as a
2650
+ ** child process, the HTTP or SCGI request is pending on file
2651
+ ** descriptor 0 and the reply should be written to file descriptor 1.
2652
+ */
26442653
if( zMaxLatency ){
26452654
signal(SIGALRM, sigalrm_handler);
26462655
alarm(atoi(zMaxLatency));
26472656
}
26482657
g.httpIn = stdin;
26492658
--- src/main.c
+++ src/main.c
@@ -2639,10 +2639,19 @@
2639 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2640 db_close(1);
2641 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2642 fossil_fatal("unable to listen on TCP socket %d", iPort);
2643 }
 
 
 
 
 
 
 
 
 
2644 if( zMaxLatency ){
2645 signal(SIGALRM, sigalrm_handler);
2646 alarm(atoi(zMaxLatency));
2647 }
2648 g.httpIn = stdin;
2649
--- src/main.c
+++ src/main.c
@@ -2639,10 +2639,19 @@
2639 if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT;
2640 db_close(1);
2641 if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){
2642 fossil_fatal("unable to listen on TCP socket %d", iPort);
2643 }
2644 /* For the parent process, the cgi_http_server() command above never
2645 ** returns (except in the case of an error). Instead, for each incoming
2646 ** client connection, a child process is created, file descriptors 0
2647 ** and 1 are bound to that connection, and the child returns.
2648 **
2649 ** So, when control reaches this point, we are running as a
2650 ** child process, the HTTP or SCGI request is pending on file
2651 ** descriptor 0 and the reply should be written to file descriptor 1.
2652 */
2653 if( zMaxLatency ){
2654 signal(SIGALRM, sigalrm_handler);
2655 alarm(atoi(zMaxLatency));
2656 }
2657 g.httpIn = stdin;
2658

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button