aboutsummaryrefslogtreecommitdiff
path: root/src/Startup.c
diff options
context:
space:
mode:
authorjshalf <jshalf@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2001-05-18 02:50:51 +0000
committerjshalf <jshalf@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2001-05-18 02:50:51 +0000
commit8b12a1b456d296db9c305a1f008dbf93f515301c (patch)
tree3cdb29f0a47b626f26d4b18055b676a5a0b32ee2 /src/Startup.c
parentd843bdb3d90b9a4fc22ddff4c750376d27d0105e (diff)
Modifications so that all cluster nodes involved in a simulation will
use http server redirect to route web-browsers to the master httpd node. The modifications are able to sense the different between nodes on the same SMP with shared network interface and those on different boxes. Tested on SP2, IA64, and IA32 clusters so far. git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@128 1faa4e14-9dd3-4be0-9f0e-ffe519881164
Diffstat (limited to 'src/Startup.c')
-rw-r--r--src/Startup.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/Startup.c b/src/Startup.c
index 1969dfa..a44c540 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -45,7 +45,7 @@ static void HTTP_SetupPollingThread(cGH *cctkGH);
***************** Scheduled Routine Prototypes *********************
********************************************************************/
-int HTTP_Startup(void);
+int HTTP_Startup(CCTK_ARGUMENTS);
void HTTP_Work(CCTK_ARGUMENTS);
int HTTP_Shutdown(void);
@@ -82,28 +82,31 @@ static int thread_started = 0;
@endhistory
@@*/
-int HTTP_Startup(void)
+int HTTP_Startup(CCTK_ARGUMENTS)
{
DECLARE_CCTK_PARAMETERS
httpState state;
- if(CCTK_MyProc(NULL) == 0)
+ if(CCTK_MyProc(NULL)==0)
{
/* Does the server provide any pages by default ? */
if(provide_pages)
{
HTTP_RegisterPages();
}
-
+
HTTP_SetupServer(port, queue_length, hunt);
}
+ else
+ HTTP_RegisterRedirect();
+ HTTP_SetupRedirect(cctkGH,port,queue_length,hunt);
HTTP_UpdateState(NULL, &state);
do
{
- if(CCTK_MyProc(NULL) == 0)
+ if(HTTP_IsServer())
{
HTTP_Poll(NULL, state.timeout_seconds, state.timeout_useconds);
}
@@ -148,7 +151,7 @@ void HTTP_Work(CCTK_ARGUMENTS)
httpState state;
#ifdef CCTK_PTHREADS
- if(CCTK_MyProc(cctkGH) == 0 && use_pthreads && ! thread_started)
+ if(HTTP_IsServer() && use_pthreads && ! thread_started)
{
HTTP_SetupPollingThread(cctkGH);
}
@@ -162,7 +165,7 @@ void HTTP_Work(CCTK_ARGUMENTS)
if(!use_pthreads)
{
#endif
- if(CCTK_MyProc(cctkGH) == 0)
+ if(HTTP_IsServer())
{
HTTP_Poll(cctkGH, state.timeout_seconds, state.timeout_useconds);
}
@@ -204,16 +207,21 @@ int HTTP_Shutdown(void)
{
DECLARE_CCTK_PARAMETERS
#ifdef CCTK_PTHREADS
+<<<<<<< Startup.c
+ /* Wait for the polling thread to exit */
+ if(HTTP_IsServer() && use_pthreads && thread_started)
+=======
/* Set the "HTTPD::terminate" parameter to flag termination
to the polling thread and wait for it to exit */
if(CCTK_MyProc(NULL) == 0 && use_pthreads && thread_started)
+>>>>>>> 1.15
{
CCTK_ParameterSet("terminate", CCTK_THORNSTRING, "yes");
pthread_join(polling_thread, NULL);
}
#endif
- if(CCTK_MyProc(NULL) == 0)
+ if(HTTP_IsServer())
{
HTTP_ShutdownServer();
}