aboutsummaryrefslogtreecommitdiff
path: root/src/Startup.c
diff options
context:
space:
mode:
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();
}