Fossil SCM

The "fossil server" command keeps track of the total number of requests and displays that value on the /test_env page.

drh 2017-12-23 02:43 trunk
Commit 41c7caad8a622afba09ebca9fe0a2883c2d4260db5f70af5a5541b133dff7027
+6 -1
--- src/cgi.c
+++ src/cgi.c
@@ -1782,10 +1782,11 @@
17821782
/* Use win32_http_server() instead */
17831783
fossil_exit(1);
17841784
#else
17851785
int listener = -1; /* The server socket */
17861786
int connection; /* A socket for each individual connection */
1787
+ int nRequest = 0; /* Number of requests handled so far */
17871788
fd_set readfds; /* Set of file descriptors for select() */
17881789
socklen_t lenaddr; /* Length of the inaddr structure */
17891790
int child; /* PID of the child process */
17901791
int nchildren = 0; /* Number of child processes */
17911792
struct timeval delay; /* How long to wait inside select() */
@@ -1869,11 +1870,14 @@
18691870
lenaddr = sizeof(inaddr);
18701871
connection = accept(listener, (struct sockaddr*)&inaddr, &lenaddr);
18711872
if( connection>=0 ){
18721873
child = fork();
18731874
if( child!=0 ){
1874
- if( child>0 ) nchildren++;
1875
+ if( child>0 ){
1876
+ nchildren++;
1877
+ nRequest++;
1878
+ }
18751879
close(connection);
18761880
}else{
18771881
int nErr = 0, fd;
18781882
close(0);
18791883
fd = dup(connection);
@@ -1886,10 +1890,11 @@
18861890
fd = dup(connection);
18871891
if( fd!=2 ) nErr++;
18881892
}
18891893
close(connection);
18901894
g.nPendingRequest = nchildren+1;
1895
+ g.nRequest = nRequest+1;
18911896
return nErr;
18921897
}
18931898
}
18941899
}
18951900
/* Bury dead children */
18961901
--- src/cgi.c
+++ src/cgi.c
@@ -1782,10 +1782,11 @@
1782 /* Use win32_http_server() instead */
1783 fossil_exit(1);
1784 #else
1785 int listener = -1; /* The server socket */
1786 int connection; /* A socket for each individual connection */
 
1787 fd_set readfds; /* Set of file descriptors for select() */
1788 socklen_t lenaddr; /* Length of the inaddr structure */
1789 int child; /* PID of the child process */
1790 int nchildren = 0; /* Number of child processes */
1791 struct timeval delay; /* How long to wait inside select() */
@@ -1869,11 +1870,14 @@
1869 lenaddr = sizeof(inaddr);
1870 connection = accept(listener, (struct sockaddr*)&inaddr, &lenaddr);
1871 if( connection>=0 ){
1872 child = fork();
1873 if( child!=0 ){
1874 if( child>0 ) nchildren++;
 
 
 
1875 close(connection);
1876 }else{
1877 int nErr = 0, fd;
1878 close(0);
1879 fd = dup(connection);
@@ -1886,10 +1890,11 @@
1886 fd = dup(connection);
1887 if( fd!=2 ) nErr++;
1888 }
1889 close(connection);
1890 g.nPendingRequest = nchildren+1;
 
1891 return nErr;
1892 }
1893 }
1894 }
1895 /* Bury dead children */
1896
--- src/cgi.c
+++ src/cgi.c
@@ -1782,10 +1782,11 @@
1782 /* Use win32_http_server() instead */
1783 fossil_exit(1);
1784 #else
1785 int listener = -1; /* The server socket */
1786 int connection; /* A socket for each individual connection */
1787 int nRequest = 0; /* Number of requests handled so far */
1788 fd_set readfds; /* Set of file descriptors for select() */
1789 socklen_t lenaddr; /* Length of the inaddr structure */
1790 int child; /* PID of the child process */
1791 int nchildren = 0; /* Number of child processes */
1792 struct timeval delay; /* How long to wait inside select() */
@@ -1869,11 +1870,14 @@
1870 lenaddr = sizeof(inaddr);
1871 connection = accept(listener, (struct sockaddr*)&inaddr, &lenaddr);
1872 if( connection>=0 ){
1873 child = fork();
1874 if( child!=0 ){
1875 if( child>0 ){
1876 nchildren++;
1877 nRequest++;
1878 }
1879 close(connection);
1880 }else{
1881 int nErr = 0, fd;
1882 close(0);
1883 fd = dup(connection);
@@ -1886,10 +1890,11 @@
1890 fd = dup(connection);
1891 if( fd!=2 ) nErr++;
1892 }
1893 close(connection);
1894 g.nPendingRequest = nchildren+1;
1895 g.nRequest = nRequest+1;
1896 return nErr;
1897 }
1898 }
1899 }
1900 /* Bury dead children */
1901
+1
--- src/main.c
+++ src/main.c
@@ -234,10 +234,11 @@
234234
const char **azAuxOpt[MX_AUX]; /* Options of each option() value */
235235
int anAuxCols[MX_AUX]; /* Number of columns for option() values */
236236
int allowSymlinks; /* Cached "allow-symlinks" option */
237237
int mainTimerId; /* Set to fossil_timer_start() */
238238
int nPendingRequest; /* # of HTTP requests in "fossil server" */
239
+ int nRequest; /* Total # of HTTP request */
239240
#ifdef FOSSIL_ENABLE_JSON
240241
struct FossilJsonBits {
241242
int isJsonMode; /* True if running in JSON mode, else
242243
false. This changes how errors are
243244
reported. In JSON mode we try to
244245
--- src/main.c
+++ src/main.c
@@ -234,10 +234,11 @@
234 const char **azAuxOpt[MX_AUX]; /* Options of each option() value */
235 int anAuxCols[MX_AUX]; /* Number of columns for option() values */
236 int allowSymlinks; /* Cached "allow-symlinks" option */
237 int mainTimerId; /* Set to fossil_timer_start() */
238 int nPendingRequest; /* # of HTTP requests in "fossil server" */
 
239 #ifdef FOSSIL_ENABLE_JSON
240 struct FossilJsonBits {
241 int isJsonMode; /* True if running in JSON mode, else
242 false. This changes how errors are
243 reported. In JSON mode we try to
244
--- src/main.c
+++ src/main.c
@@ -234,10 +234,11 @@
234 const char **azAuxOpt[MX_AUX]; /* Options of each option() value */
235 int anAuxCols[MX_AUX]; /* Number of columns for option() values */
236 int allowSymlinks; /* Cached "allow-symlinks" option */
237 int mainTimerId; /* Set to fossil_timer_start() */
238 int nPendingRequest; /* # of HTTP requests in "fossil server" */
239 int nRequest; /* Total # of HTTP request */
240 #ifdef FOSSIL_ENABLE_JSON
241 struct FossilJsonBits {
242 int isJsonMode; /* True if running in JSON mode, else
243 false. This changes how errors are
244 reported. In JSON mode we try to
245
--- src/style.c
+++ src/style.c
@@ -908,10 +908,11 @@
908908
}
909909
zCap[i] = 0;
910910
@ g.userUid = %d(g.userUid)<br />
911911
@ g.zLogin = %h(g.zLogin)<br />
912912
@ g.isHuman = %d(g.isHuman)<br />
913
+ @ g.nRequest = %d(g.nRequest)<br />
913914
if( g.nPendingRequest>1 ){
914915
@ g.nPendingRequest = %d(g.nPendingRequest)<br />
915916
}
916917
@ capabilities = %s(zCap)<br />
917918
for(i=0, c='a'; c<='z'; c++){
918919
--- src/style.c
+++ src/style.c
@@ -908,10 +908,11 @@
908 }
909 zCap[i] = 0;
910 @ g.userUid = %d(g.userUid)<br />
911 @ g.zLogin = %h(g.zLogin)<br />
912 @ g.isHuman = %d(g.isHuman)<br />
 
913 if( g.nPendingRequest>1 ){
914 @ g.nPendingRequest = %d(g.nPendingRequest)<br />
915 }
916 @ capabilities = %s(zCap)<br />
917 for(i=0, c='a'; c<='z'; c++){
918
--- src/style.c
+++ src/style.c
@@ -908,10 +908,11 @@
908 }
909 zCap[i] = 0;
910 @ g.userUid = %d(g.userUid)<br />
911 @ g.zLogin = %h(g.zLogin)<br />
912 @ g.isHuman = %d(g.isHuman)<br />
913 @ g.nRequest = %d(g.nRequest)<br />
914 if( g.nPendingRequest>1 ){
915 @ g.nPendingRequest = %d(g.nPendingRequest)<br />
916 }
917 @ capabilities = %s(zCap)<br />
918 for(i=0, c='a'; c<='z'; c++){
919

Keyboard Shortcuts

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