diff options
author | goodale <goodale@1faa4e14-9dd3-4be0-9f0e-ffe519881164> | 2002-11-12 19:38:39 +0000 |
---|---|---|
committer | goodale <goodale@1faa4e14-9dd3-4be0-9f0e-ffe519881164> | 2002-11-12 19:38:39 +0000 |
commit | e6cb6f3e481c5aba5b50b87f7a736dd59daa2ae5 (patch) | |
tree | c908e2fca6c71419488247296a6f0235a638e7ef | |
parent | 6b22c5d059651087ff9e5a301caf877c40dcdfb6 (diff) |
Re-organised startup a bit. Now HTTP_Startup is a group.
HTTP_Startup has three things scheduled in it, in order:
HTTP_StartServer
which starts the web-server
GROUP HTTP_SetupPages
which can be used by anything which needs to know the location of
the webserver before the webserver starts listening
HTTP_FirstServ
which listens for connections and may sit there if httpd::pause is
true.
The reason for this cahnge is that I need to advertise the location of the
webserver, but then have Cactus sitting in pause mode, and the old logic
didn't allow this.
Hopefully by not chaning the name of HTTP_Startup no existing code should
be affected.
Tom
git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@175 1faa4e14-9dd3-4be0-9f0e-ffe519881164
-rw-r--r-- | schedule.ccl | 22 | ||||
-rw-r--r-- | src/Startup.c | 32 |
2 files changed, 47 insertions, 7 deletions
diff --git a/schedule.ccl b/schedule.ccl index a6c787e..674319b 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -1,22 +1,36 @@ # Schedule definitions for thorn httpd # $Header$ -SCHEDULE HTTP_Startup AT startup +SCHEDULE GROUP HTTP_Startup AT startup { LANG: C -} "HTTP daemon startup" +} "HTTP daemon startup group" + +SCHEDULE HTTP_StartServer in HTTP_Startup +{ + LANG: C +} "Start HTTP server" + +SCHEDULE GROUP HTTP_SetupPages in HTTP_Startup AFTER HTTP_StartServer +{ +} "Group to setup stuff which needs to be done between starting the server and the first time it serves pages" + +SCHEDULE HTTP_FirstServ in HTTP_Startup AFTER HTTP_SetupPages +{ + LANG: C +} "Serve first pages at startup" SCHEDULE HTTP_Work AT poststep BEFORE IOUtil_UpdateParFile { LANG: C -} "HTTP working routine" +} "Working routine" if(provide_pages) { SCHEDULE HTTP_ContentWork AT poststep { LANG: C - } "HTTP Content Working routine" + } "Content Working routine" } SCHEDULE HTTP_Shutdown AT shutdown diff --git a/src/Startup.c b/src/Startup.c index 06d8e30..e147b31 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -47,6 +47,7 @@ static void HTTP_SetupPollingThread(cGH *cctkGH); ********************************************************************/ int HTTP_Startup(void); +int HTTP_FirstServ(void); void HTTP_Work(CCTK_ARGUMENTS); int HTTP_Shutdown(void); @@ -70,11 +71,11 @@ static int thread_started = 0; /*@@ - @routine HTTP_Startup + @routine HTTP_StartServer @date Wed Sep 13 21:26:56 2000 @author Tom Goodale @desc - Startup routine for the webserver. + Starts the webserver. @enddesc @calls @calledby @@ -84,7 +85,7 @@ static int thread_started = 0; @@*/ -int HTTP_Startup(void) +int HTTP_StartServer(void) { int use_port; httpState state; @@ -136,6 +137,31 @@ int HTTP_Startup(void) /* Do we need to redirect to a master server ? */ HTTP_SetupRedirect(use_port,queue_length,hunt); + return 0; +} + + /*@@ + @routine HTTP_FirstServ + @date Tue Nov 12 20:32:36 2002 + @author Tom Goodale + @desc + Listens for connection requests. + @enddesc + @calls + @calledby + @history + @hdate Tue Nov 12 20:33:07 2002 @hauthor Tom Goodale + @hdesc This was originally in HTTP_StartServer but + that made it impossible to spawn a task telling + it where the webserver was if httpd::pause was "true". + @endhistory + + @@*/ +int HTTP_FirstServ(void) +{ + + httpState state; + HTTP_UpdateState(NULL, &state); do |